Merge pull request #317 from gnustep/NSLock_fix_issue316

This commit is contained in:
Gregory Casamento 2023-09-19 12:41:12 -04:00 committed by GitHub
commit dbfbf3766a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 2 deletions

View file

@ -36,12 +36,14 @@
#import "GSPrivate.h"
#import "GSPThread.h"
#include <math.h>
#include <stdlib.h>
#import "common.h"
#import "Foundation/NSLock.h"
#import "Foundation/NSException.h"
#import "Foundation/NSThread.h"
// #import "Foundation/NSUserDefaults.h"
#define class_createInstance(C,E) NSAllocateObject(C,E,NSDefaultMallocZone())
@ -247,8 +249,16 @@ static BOOL traceLocks = NO;
{\
if (0 != GS_MUTEX_UNLOCK(_mutex))\
{\
[NSException raise: NSLockException\
format: @"failed to unlock mutex"];\
if (GSPrivateDefaultsFlag(GSMacOSXCompatible))\
{\
NSLog(@"Failed to unlock mutex %@ at %@",\
self, [NSThread callStackSymbols]);\
}\
else \
{\
[NSException raise: NSLockException\
format: @"failed to unlock mutex %@", self];\
}\
}\
CHK(Drop) \
}