From dc775bc5f89461c0e6808a7464bee6f8ae818499 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Tue, 6 Jun 2017 09:25:48 +0200 Subject: Fixed false positives when checking the locking sequence, in case of nested locks within the same thread --- HISTORY | 5 +++++ config.h | 10 +++++----- thread.c | 13 ++++++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/HISTORY b/HISTORY index 32876ee3..ce46e793 100644 --- a/HISTORY +++ b/HISTORY @@ -9102,3 +9102,8 @@ Video Disk Recorder Revision History - Fixed the locking sequence when creating a new timer from the Schedules menu. - Fixed the locking sequence when switching between 'Now', 'Next' and 'Schedule' in the Schedules menu. + +2017-06-06: Version 2.3.7 + +- Fixed false positives when checking the locking sequence, in case of nested locks + within the same thread. diff --git a/config.h b/config.h index 1b6e996e..4da4ae76 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 4.10 2017/05/28 12:42:49 kls Exp $ + * $Id: config.h 4.11 2017/06/05 11:15:37 kls Exp $ */ #ifndef __CONFIG_H @@ -22,13 +22,13 @@ // VDR's own version number: -#define VDRVERSION "2.3.6" -#define VDRVERSNUM 20306 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "2.3.7" +#define VDRVERSNUM 20307 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: -#define APIVERSION "2.3.6" -#define APIVERSNUM 20306 // Version * 10000 + Major * 100 + Minor +#define APIVERSION "2.3.7" +#define APIVERSNUM 20307 // Version * 10000 + Major * 100 + Minor // When loading plugins, VDR searches them by their APIVERSION, which // may be smaller than VDRVERSION in case there have been no changes to diff --git a/thread.c b/thread.c index 345f2af4..e6ae889e 100644 --- a/thread.c +++ b/thread.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: thread.c 4.4 2017/06/03 12:43:22 kls Exp $ + * $Id: thread.c 4.5 2017/06/06 09:11:03 kls Exp $ */ #include "thread.h" @@ -568,6 +568,7 @@ private: cVector flags; tThreadId logThreadIds[SLL_SIZE]; int logFlags[SLL_SIZE]; + uint8_t logCounter[SLL_SIZE][SLL_MAX_LIST]; char logCaller[SLL_SIZE][SLL_LENGTH]; int logIndex; bool dumped; @@ -581,6 +582,7 @@ cStateLockLog::cStateLockLog(void) { memset(logThreadIds, 0, sizeof(logThreadIds)); memset(logFlags, 0, sizeof(logFlags)); + memset(logCounter, 0, sizeof(logCounter)); memset(logCaller, 0, sizeof(logCaller)); logIndex = 0; dumped = false; @@ -630,9 +632,9 @@ void cStateLockLog::Dump(const char *Name, tThreadId ThreadId) void cStateLockLog::Check(const char *Name, bool Lock, bool Write) { if (!dumped && Name) { - int n = *Name - '0'; - if (1 <= n && n <= SLL_MAX_LIST) { - int b = 1 << (n - 1); + int n = *Name - '0' - 1; + if (0 < n && n < SLL_MAX_LIST) { + int b = 1 << n; cMutexLock MutexLock(&mutex); tThreadId ThreadId = cThread::ThreadId(); int Index = threadIds.IndexOf(ThreadId); @@ -651,9 +653,10 @@ void cStateLockLog::Check(const char *Name, bool Lock, bool Write) ; else if ((flags[Index] & b) == 0) // thread already holds "bigger" locks, so it may only re-lock one that it already has! DoDump = true; + logCounter[Index][n]++; flags[Index] |= b; } - else + else if (--logCounter[Index][n] == 0) flags[Index] &= ~b; logThreadIds[logIndex] = ThreadId; logFlags[logIndex] = flags[Index] | (Write ? SLL_WRITE_FLAG : 0); -- cgit v1.2.3