Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

More scheduler/recorder deadlock avoidance.

RecordPending() can block so it needs to have schedLock released
around calls to it too.

(cherry picked from commit 6cb14ee)
  • Loading branch information...
commit 5a51df76f93369cd383338d6469fdbf8639572c8 1 parent 09d9504
@gigem gigem authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 mythtv/programs/mythbackend/scheduler.cpp
View
13 mythtv/programs/mythbackend/scheduler.cpp
@@ -2363,7 +2363,11 @@ bool Scheduler::HandleRecording(
return false;
}
+ // Use this temporary copy of ri when schedLock is not held. Be
+ // sure to update it as long as it is still needed whenever ri
+ // changes.
RecordingInfo tempri(ri);
+
schedLock.unlock();
bool isBusyRecording = IsBusyRecording(&tempri);
schedLock.lock();
@@ -2435,13 +2439,18 @@ bool Scheduler::HandleRecording(
recording_dir,
reclist);
ri.SetPathname(recording_dir);
+ tempri.SetPathname(recording_dir);
}
if (!recPendingList[schedid])
{
- nexttv->RecordPending(&ri, max(secsleft, 0),
+ schedLock.unlock();
+ nexttv->RecordPending(&tempri, max(secsleft, 0),
hasLaterList.contains(schedid));
recPendingList[schedid] = true;
+ schedLock.lock();
+ if (reclist_changed)
+ return reclist_changed;
}
if (secsleft > 0)
@@ -2451,6 +2460,7 @@ bool Scheduler::HandleRecording(
recstartts.setTime(
QTime(recstartts.time().hour(), recstartts.time().minute()));
ri.SetRecordingStartTime(recstartts);
+ tempri.SetRecordingStartTime(recstartts);
QString details = QString("%1: channel %2 on cardid %3, sourceid %4")
.arg(ri.toString(ProgramInfo::kTitleSubtitle))
@@ -2463,7 +2473,6 @@ bool Scheduler::HandleRecording(
{
if (ri.GetRecordingStatus() == rsWillRecord)
{
- tempri = ri;
schedLock.unlock();
recStatus = nexttv->StartRecording(&tempri);
schedLock.lock();
Please sign in to comment.
Something went wrong with that request. Please try again.