[mythtv] [PATCH] Fix for DVB freezes

Isaac Richards ijr at po.cwru.edu
Tue Mar 30 01:06:50 EST 2004

On Monday 29 March 2004 08:40 am, Dan Sheridan wrote:
> It's taken me about three weeks of debugging, but here, at last, is a
> fix for the freezes that have been plaguing me in MythTV. The problem is
> as follows: the quality monitoring thread wakes up every so often and
> checks the quality data from the card which it then commits to the
> database. When the a recoding finishes, the thread is *cancelled*, which
> may happen at any time; with a slow enough database or a fast enough
> poll rate for the quality data, there is a good chance that the thread
> is cancelled while it holds the database lock. This results in a
> deadlock: the state change from RecordingOnly to None cannot complete,
> holding up everything else.

I've applied this to CVS..

> The problem with debugging comes from a bizarre gcc policy where if a
> call to the stdlib (eg cerr << "debugging info"...) is running when a
> thread is cancelled, the whole program terminates with a "FATAL:
> exception not rethrown" error, which is not documented anywhere! The
> patch below therefore replaces the pthread_cancel with a semaphore in
> the style of the rest of the code; the catch is that if the monitoring
> interval for the quality thread is too large it may take a while to
> exit. (In fact, if the card is reopened before the thread has stopped
> the semaphore will be reset and two instances of the thread will
> continue to run. Any suggestions?)

Make it a wait condition instead of a blind sleep, perhaps?


More information about the mythtv-dev mailing list