[mythtv] more on dvb record failure (race condition in
signalmonitor.cpp?)
Mark Weaver
mark-clist at npsl.co.uk
Mon Aug 22 15:56:40 UTC 2005
I am also having trouble with DVB (livetv|recording) -- sometimes
getting the PMT timeout. I have tried latest SVN but the backend seems
very unstable for me. I've done a little debugging, so far I think I
have found a race condition in signalmonitor.cpp:
In signalmonitor.cpp there is a race condition:
void SignalMonitor::Start()
{
VERBOSE(VB_CHANNEL, "SignalMonitor::Start() -- begin");
if (!running)
pthread_create(&monitor_thread, NULL, SpawnMonitorLoop, this);
while (!running)
usleep(50);
and
void SignalMonitor::MonitorLoop()
{
//signal(SIGALRM, ALRMhandler);
running = true;
exit = false;
and
void SignalMonitor::Stop()
{
if (running)
{
exit = true;
pthread_join(monitor_thread, NULL);
}
If you Start/Stop rapidly then it might be the case that 'exit' can be
set to true by the line in Stop(), then set to false again by
MonitorLoop() leading to a thread that doesn't die.
Admittedly it doesn't look very likely to occur but I have an instance
in gdb that is stuck in exactly this way (one thread in MonitorLoop()
with this->exit = false, and one thread in pthread_join from
SignalMonitor::Stop() with the same 'this' pointer.
I think it would be reasonable to remove the exit = false; in
MonitorLoop() to correct this -- it is set to false by the c'tor.
More information about the mythtv-dev
mailing list