Skip to content

Commit

Permalink
Add GSMacOSXCompatible check, do it just to unlock since that is the …
Browse files Browse the repository at this point in the history
…immediate issue
  • Loading branch information
gcasa committed Sep 9, 2023
1 parent 5d31b35 commit 8611c76
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion Source/NSLock.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#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())

Expand All @@ -61,6 +62,7 @@
static Class untracedRecursiveLockClass = Nil;

static BOOL traceLocks = NO;
static BOOL compatible = NO;

@implementation NSObject (GSTraceLocks)

Expand Down Expand Up @@ -247,7 +249,11 @@ - (void) unlock\
{\
if (0 != GS_MUTEX_UNLOCK(_mutex))\
{\
NSLog(@"failed to unlock mutex");\
if (compatible)\
{\
[NSException raise: NSLockException\
format: @"failed to unlock mutex"];\
}\
}\
CHK(Drop) \
}
Expand Down Expand Up @@ -342,6 +348,7 @@ + (void) initialize
untracedConditionLockClass = [GSUntracedConditionLock class];
untracedLockClass = [GSUntracedLock class];
untracedRecursiveLockClass = [GSUntracedRecursiveLock class];
compatible = [[NSUserDefaults standardUserDefaults] boolForKey: @"GSMacOSXCompatible"];
}
}

Expand Down

0 comments on commit 8611c76

Please sign in to comment.