Ticket #2019: eventloop_thread_condition.patch

File eventloop_thread_condition.patch, 1.3 KB (added by russell@…, 18 years ago)
  • libs/libmythtv/tv_play.h

     
    567567    /// runs pipnvp's NuppelVideoPlayer::StartPlaying().
    568568    pthread_t pipdecode;
    569569
     570    /// Condition to signal that the Event thread is up and running
     571    QWaitCondition mainLoopCond;
     572    QMutex mainLoopCondLock;
     573
    570574    // Constants
    571575    static const int kInitFFRWSpeed; ///< 1x, default to normal speed
    572576    static const int kMuteTimeout;   ///< Channel changing mute timeout in msec
  • libs/libmythtv/tv_play.cpp

     
    484484        qApp->processEvents();
    485485    }
    486486
     487    mainLoopCondLock.lock();
    487488    pthread_create(&event, NULL, EventThread, this);
     489    mainLoopCond.wait(&mainLoopCondLock);
     490    mainLoopCondLock.unlock();
    488491
    489     while (!runMainLoop && !IsErrored())
    490         usleep(50);
    491 
    492492    return !IsErrored();
    493493}
    494494
     
    15031503    runMainLoop = true;
    15041504    exitPlayer = false;
    15051505
     1506    mainLoopCondLock.lock();
     1507    mainLoopCond.wakeAll();
     1508    mainLoopCondLock.unlock();
     1509
    15061510    while (runMainLoop)
    15071511    {
    15081512        stateLock.lock();