Fixed a possible deadlock in the recordings handler thread

This commit is contained in:
Klaus Schmidinger 2017-01-01 17:52:51 +01:00
parent f345908f77
commit 1c7c2f50b0
2 changed files with 13 additions and 9 deletions

View File

@ -8882,7 +8882,7 @@ Video Disk Recorder Revision History
- Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to - Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to
Sergey Chernyavskiy). Sergey Chernyavskiy).
2016-12-27: Version 2.3.3 2017-01-01: Version 2.3.3
- Added 'S3W ABS-3A' to sources.conf (thanks to Frank Richter). - Added 'S3W ABS-3A' to sources.conf (thanks to Frank Richter).
- Fixed a possible deadlock in the recordings handler thread.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * how to reach the author.
* *
* $Id: recording.c 4.6 2016/12/22 12:58:20 kls Exp $ * $Id: recording.c 4.7 2017/01/01 17:52:51 kls Exp $
*/ */
#include "recording.h" #include "recording.h"
@ -1914,16 +1914,20 @@ cRecordingsHandler::~cRecordingsHandler()
void cRecordingsHandler::Action(void) void cRecordingsHandler::Action(void)
{ {
while (Running()) { while (Running()) {
bool Sleep = false;
{ {
cMutexLock MutexLock(&mutex); cMutexLock MutexLock(&mutex);
while (cRecordingsHandlerEntry *r = operations.First()) { if (cRecordingsHandlerEntry *r = operations.First()) {
if (!r->Active(error)) if (!r->Active(error))
operations.Del(r); operations.Del(r);
} else
if (!operations.Count()) Sleep = true;
}
else
break; break;
} }
cCondWait::SleepMs(100); if (Sleep)
cCondWait::SleepMs(100);
} }
} }