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

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] How to kill a rogue (p)thread
From: Arve Knudsen (aknuds-1_AT_broadpark.no)
Date: Tue Mar 30 2004 - 19:11:14 EEST


On Tue, 30 Mar 2004 11:38:54 +0200, Jens M Andreasen
<jens.andreasen_AT_chello.se> wrote:

> 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.
>
I was thinking PTHREAD_CANCEL_ASYNCHRONOUS would be the option, but I
already rely on the default behaviour (deferred) for the regular cases,
where I politely ask the thread to exit. So I was thinking of some other
alternative. The older code I'm using as a reference, makes use of
pthread_kill. At first I thought the NPTL lib simply lacked this function
(not in pthread.h), but I see now its included through signal.h :p

Thanks

Arve Knudsen


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Tue Mar 30 2004 - 19:12:32 EEST