Ticket #5341: GetNextLiveTVDir_tryLock.diff

File GetNextLiveTVDir_tryLock.diff, 1019 bytes (added by Shane Shrybman, 11 years ago)
  • mythtv/programs/mythbackend/scheduler.cpp

    static bool comp_dirpreference(FileSystemInfo *a, FileSystemInfo *b) 
    36793679
    36803680void Scheduler::GetNextLiveTVDir(int cardid)
    36813681{
    3682     QMutexLocker lockit(reclist_lock);
     3682    int lock_attempts = 0;
     3683
     3684    while (lock_attempts++ < 5 && !reclist_lock->tryLock())
     3685    {
     3686        VERBOSE(VB_IMPORTANT, LOC + "FindNextLiveTVDir: tryLock failed: "<<lock_attempts);
     3687        usleep(5000);
     3688    }
     3689
     3690    if (lock_attempts >= 5)
     3691        return;
    36833692
    36843693    ProgramInfo *pginfo = new ProgramInfo;
    36853694
    void Scheduler::GetNextLiveTVDir(int cardid) 
    37013710
    37023711    int fsID = FillRecordingDir(pginfo, reclist);
    37033712
     3713    reclist_lock->unlock();
     3714
    37043715    tv->SetNextLiveTVDir(pginfo->pathname);
    37053716
    37063717    VERBOSE(VB_RECORD, LOC + QString("FindNextLiveTVDir: next dir is '%1'")