[Kwintv] Re: V4L Plugin - new success

Koos Vriezen koos.vriezen at xs4all.nl
Mon Dec 15 00:06:15 CET 2003


Dirk wrote:
> Could we use QThread::terminate()? Yes, it's not very clean, but we now the 
> grabber thread is not holding the qApp lock since we are in the event loop, 
> and we don't care about the thread holding the devMutex since we won't be 
> using it any more. To be sure, we could also acquire the devMutex before 
> killing the thread. Find attached a patch for it. What do you think, Koos?

Makes sense to acquire the devMutex so it's not grabbing. Reading the man page
of pthread_cancel, it doesn't mention pthread_mutex_lock as a cancellation point,
so I don't know. Sound like a hack too :-)

The only reason for my hack was closing qtvision. So if we are in stopVideo and
we have the devMutex lock, then we know the thread is either trying to get the 
devMutex or qApp lock. Now if we add the stop condition check inside these
locks and let the thread destroy itself outside the while loop (like qtvision4.diff)
With the addition to sleep for a second or so after qApp->exec() returns and
before qApp is destroyed and of course V4LGrabber should own the devMutex.
(now I realize what qtvision4.diff was missing).

Koos


More information about the kwintv mailing list