Subject: Re: [linux-audio-dev] How to kill a rogue (p)thread
From: Jack O'Quin (joq_AT_io.com)
Date: Wed Mar 31 2004 - 19:44:15 EEST
Arve Knudsen <aknuds-1_AT_broadpark.no> writes:
> The thing is I don't have complete control over the audio thread, a
> user defined callback is involved. In working on the ALSA
> implementation of the PortAudio library there has been a request for
> realtime scheduling of the audio thread, similar to the older OSS
> implementation. The OSS implementation starts both a watchdog and a
> canary thread; the watchdog will kill the audio thread (with SIGKILL)
> if it doesn't respond within 3-second intervals, or lower it's
> priority if the (normal priority) canary thread is starved.
You can do something like this...
int oldtype;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype);
/* invoke the callback */
framesProcessed = PaUtil_EndBufferProcessing( &stream->bufferProcessor,
&callbackResult );
/* restore original canceltype setting */
pthread_setcanceltype(oldtype, NULL);
-- joq
This archive was generated by hypermail 2b28 : Wed Mar 31 2004 - 19:45:23 EEST