summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-01-01 17:52:51 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2017-01-01 17:52:51 +0100
commit1c7c2f50b0c5c2798142c55c32294cf5458d98bd (patch)
tree4f8c3f9156f0f92ccc239e0058081040793d21cd
parentf345908f779aa5b64b7f052f416babe55241a46f (diff)
downloadvdr-1c7c2f50b0c5c2798142c55c32294cf5458d98bd.tar.gz
vdr-1c7c2f50b0c5c2798142c55c32294cf5458d98bd.tar.bz2
Fixed a possible deadlock in the recordings handler thread
-rw-r--r--HISTORY4
-rw-r--r--recording.c18
2 files changed, 13 insertions, 9 deletions
diff --git a/HISTORY b/HISTORY
index 75426782..090446ac 100644
--- a/HISTORY
+++ b/HISTORY
@@ -8882,7 +8882,7 @@ Video Disk Recorder Revision History
- Added a short sleep to cTSBuffer::Action() to avoid high CPU usage (thanks to
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).
-
+- Fixed a possible deadlock in the recordings handler thread.
diff --git a/recording.c b/recording.c
index 5293459e..63980585 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.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"
@@ -1914,16 +1914,20 @@ cRecordingsHandler::~cRecordingsHandler()
void cRecordingsHandler::Action(void)
{
while (Running()) {
+ bool Sleep = false;
{
cMutexLock MutexLock(&mutex);
- while (cRecordingsHandlerEntry *r = operations.First()) {
- if (!r->Active(error))
- operations.Del(r);
- }
- if (!operations.Count())
+ if (cRecordingsHandlerEntry *r = operations.First()) {
+ if (!r->Active(error))
+ operations.Del(r);
+ else
+ Sleep = true;
+ }
+ else
break;
}
- cCondWait::SleepMs(100);
+ if (Sleep)
+ cCondWait::SleepMs(100);
}
}