Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: More V4 Video API Q's






Hi Holger,

linux-dvb-bounce@linuxtv.org wrote on 06/10/2004 21:17:53:

> Holger Waechtler wrote:
>
> >
> > Have you tried to send a signal to the blocking thread? This can in
> > any case get catched & processed in the ioctl handler.
>
>
> after a little more thinking I believe that the following would be the
> correct implementation:
>
> * open()
> * start decoder threads
> (... wait for stop command from GUI...)
> * send stop signal to threads
> * call pthread_cancel()
> * pthread_join()
> * close().
>
> Since blocking read/write and ioctl calls are defined by POSIX as
> cancellation points this should work just fine without any extra support
> in the API. After passing non-cancellation points the decoder threads
> should call pthread_testcancel().

I call pthread_cancel from the main thread to cancel the thread that is
blocked waiting for the DVB_VIDEO_GET_EVENT ioctl to return.  This returns
immediately as the blocking ioctl is a cancellation point.  I then call
pthread_join to tidy up any loose ends and obtain the return code.  I then
check the return code (PTHREAD_CANCELED) to see how the thread was
cancelled.

This works very well and is certainly something that application folk
should make a note of (if they haven't already).

Thanks Again for your help/suggestions.

Rob : )





Home | Main Index | Thread Index