Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes #10970. Fix StreamHandler restart race.

We wait for _running to be set to false, but we need the thread to be
in the finish state or QThread::start() will exit silently without
starting the thread. Since we're calling QThread::wait() we don't
really need the while (_running) loop at all in either Start() or
Stop(), so I've removed it. This race probably dates back to the
pthread->QThread porting.
  • Loading branch information...
commit 7d01e691d2bb58ed7dcbbdcca93ec06dc3a7381b 1 parent 9f0be65
@daniel-kristjansson daniel-kristjansson authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 mythtv/libs/libmythtv/streamhandler.cpp
View
13 mythtv/libs/libmythtv/streamhandler.cpp
@@ -150,9 +150,11 @@ void StreamHandler::Start(void)
if ((_using_section_reader && !_allow_section_reader) ||
(_needs_buffering && !_using_buffering))
{
+ LOG(VB_RECORD, LOG_INFO, LOC + "Restarting StreamHandler");
SetRunningDesired(false);
- while (!_running_desired && _running)
- _running_state_changed.wait(&_start_stop_lock, 100);
+ locker.unlock();
+ wait();
+ locker.relock();
}
}
@@ -170,19 +172,14 @@ void StreamHandler::Start(void)
if (_error)
{
- LOG(VB_GENERAL, LOG_WARNING, LOC + "Start failed");
+ LOG(VB_GENERAL, LOG_ERR, LOC + "Start failed");
SetRunningDesired(false);
}
}
void StreamHandler::Stop(void)
{
- QMutexLocker locker(&_start_stop_lock);
-
SetRunningDesired(false);
- while (_running)
- _running_state_changed.wait(&_start_stop_lock, 100);
-
wait();
}
Please sign in to comment.
Something went wrong with that request. Please try again.