Fixed false positives when checking the locking sequence, in case of nested locks within the same thread

This commit is contained in:
Klaus Schmidinger 2017-06-06 09:25:48 +02:00
parent ec47c4f932
commit dc775bc5f8
3 changed files with 18 additions and 10 deletions

View File

@ -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.

View File

@ -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

View File

@ -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<int> 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);