From 38fed8c9014003f4e78a54e0dfb3ef6c19ac965b Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Thu, 8 Jun 2017 08:24:30 +0200 Subject: [PATCH] Fixed L(ock) and U(nlock) indicators in cStateLockLog --- HISTORY | 3 ++- thread.c | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index ef899d1b..f4e55afb 100644 --- a/HISTORY +++ b/HISTORY @@ -9103,9 +9103,10 @@ Video Disk Recorder Revision History - Fixed the locking sequence when switching between 'Now', 'Next' and 'Schedule' in the Schedules menu. -2017-06-06: Version 2.3.7 +2017-06-08: Version 2.3.7 - Fixed false positives when checking the locking sequence, in case of nested locks within the same thread. - Fixed uninitialized variable SdWatchdog in vdr.c (reported by Frank Neumann). - Fixed the locking sequence when starting an instant recording. +- Fixed L(ock) and U(nlock) indicators in cStateLockLog. diff --git a/thread.c b/thread.c index c821526f..9da5915a 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.6 2017/06/07 12:31:31 kls Exp $ + * $Id: thread.c 4.7 2017/06/08 08:22:10 kls Exp $ */ #include "thread.h" @@ -560,6 +560,7 @@ cString cBackTrace::GetCaller(int Level, bool Mangled) #define SLL_LENGTH 256 // the maximum length of log entries #define SLL_MAX_LIST 9 // max. number of lists to log #define SLL_WRITE_FLAG 0x80000000 +#define SLL_LOCK_FLAG 0x40000000 class cStateLockLog { private: @@ -599,10 +600,10 @@ void cStateLockLog::Dump(const char *Name, tThreadId ThreadId) q += sprintf(q, "%5d", tid); int Flags = logFlags[logIndex]; bool Write = Flags & SLL_WRITE_FLAG; - Flags &= ~SLL_WRITE_FLAG; + bool Lock = Flags & SLL_LOCK_FLAG; + Flags &= ~(SLL_WRITE_FLAG | SLL_LOCK_FLAG); int Changed = LastFlags ^ Flags; LastFlags = Flags; - bool Lock = (Flags & Changed) != 0; for (int i = 0; i <= SLL_MAX_LIST; i++) { char c = '-'; int b = 1 << i; @@ -659,7 +660,7 @@ void cStateLockLog::Check(const char *Name, bool Lock, bool Write) else if (--logCounter[Index][n] == 0) flags[Index] &= ~b; logThreadIds[logIndex] = ThreadId; - logFlags[logIndex] = flags[Index] | (Write ? SLL_WRITE_FLAG : 0); + logFlags[logIndex] = flags[Index] | (Write ? SLL_WRITE_FLAG : 0) | (Lock ? SLL_LOCK_FLAG : 0); #ifdef DEBUG_LOCKCALL strn0cpy(logCaller[logIndex], cBackTrace::GetCaller(Lock ? 3 : 5, true), SLL_LENGTH); #endif