diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2017-12-04 13:07:39 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2017-12-04 13:07:39 +0100 |
commit | b96277e28a583b4dfe84823d49e8133de78daed8 (patch) | |
tree | 02a5c6aa6f59ac128525954a5779b6825dc13d5e /recording.c | |
parent | b5d8f68b87954d2e019c50642b8545e5ffd7a469 (diff) | |
download | vdr-b96277e28a583b4dfe84823d49e8133de78daed8.tar.gz vdr-b96277e28a583b4dfe84823d49e8133de78daed8.tar.bz2 |
Fixed a deadlock when moving a folder containing several recordings between different volumes
Diffstat (limited to 'recording.c')
-rw-r--r-- | recording.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/recording.c b/recording.c index e2d6e7c5..ec6db3d6 100644 --- a/recording.c +++ b/recording.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: recording.c 4.11 2017/11/27 13:58:34 kls Exp $ + * $Id: recording.c 4.12 2017/12/04 13:03:11 kls Exp $ */ #include "recording.h" @@ -1857,7 +1857,7 @@ public: int Usage(const char *FileName = NULL) const; const char *FileNameSrc(void) const { return fileNameSrc; } const char *FileNameDst(void) const { return fileNameDst; } - bool Active(bool &Error); + bool Active(cRecordings *Recordings, bool &Error); }; cRecordingsHandlerEntry::cRecordingsHandlerEntry(int Usage, const char *FileNameSrc, const char *FileNameDst) @@ -1887,7 +1887,7 @@ int cRecordingsHandlerEntry::Usage(const char *FileName) const return u; } -bool cRecordingsHandlerEntry::Active(bool &Error) +bool cRecordingsHandlerEntry::Active(cRecordings *Recordings, bool &Error) { bool CopierFinishedOk = false; // First test whether there is an ongoing operation: @@ -1917,18 +1917,18 @@ bool cRecordingsHandlerEntry::Active(bool &Error) copier->Start(); } ClearPending(); - LOCK_RECORDINGS_WRITE; // to trigger a state change + Recordings->SetModified(); // to trigger a state change return true; } // Clean up: if (CopierFinishedOk && (Usage() & ruMove) != 0) { cRecording Recording(FileNameSrc()); if (Recording.Delete()) { - LOCK_RECORDINGS_WRITE; Recordings->DelByName(Recording.FileName()); + Recordings->SetModified(); // to trigger a state change } } - LOCK_RECORDINGS_WRITE; // to trigger a state change + Recordings->SetModified(); // to trigger a state change Recordings->TouchUpdate(); return false; } @@ -1954,9 +1954,11 @@ void cRecordingsHandler::Action(void) while (Running()) { bool Sleep = false; { + LOCK_RECORDINGS_WRITE; + Recordings->SetExplicitModify(); cMutexLock MutexLock(&mutex); if (cRecordingsHandlerEntry *r = operations.First()) { - if (!r->Active(error)) + if (!r->Active(Recordings, error)) operations.Del(r); else Sleep = true; |