[linux-audio-dev] How to kill a rogue (p)thread

Jens M Andreasen jens.andreasen at chello.se
Tue Mar 30 09:38:54 UTC 2004


On tis, 2004-03-30 at 08:51, Arve Knudsen wrote:
> Hi
> 
> Could anyone explain how I should go about killing a potensially 
> unresponsive thread? Of course there's pthread_cancel, but I don't wish to 
> wait for the other thread to reach a cancel point. Basically I'm trying to 
> implement a watchdog for a realtime audio thread. Any suggestions are 
> welcome, thanks.

man pthread_cancel:

...
...

pthread_setcanceltype  changes  the  type  of responses to cancellation
requests for the calling thread: asynchronous (immediate) or  deferred.

The  type  argument  is  the new cancellation type: either

 PTHREAD_CANCEL_ASYNCHRONOUS 

to cancel the calling thread as soon as the  cancellation  request  is
received, or

 PTHREAD_CANCEL_DEFERRED 

to keep the cancellation request pending until the next cancellation
point.

/jens





More information about the Linux-audio-dev mailing list