mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
* Source/NSLock.m: Change to correct documented/tested and observed
inconsistency between Cocoa (and OpenStep) and GNUstep. Reinstatement of correction for bug #25307. Testing on both OpenStep and on Cocoa clearly illustrates that throwing an exception in this case was incorrect. It now emits a warning when the lock is attempted again, but does not throw an exception. * Testing/locktest/locktest.m: Change to test to correctly test [NSConditionLock lock] git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27726 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ff04c91300
commit
f77a3d4091
3 changed files with 21 additions and 3 deletions
|
@ -129,6 +129,14 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
} \
|
||||
}
|
||||
|
||||
#define WARN_RECURSIVE_CONDITION_LOCK(mutex) \
|
||||
{ \
|
||||
if ((mutex)->owner == objc_thread_id()) \
|
||||
{ \
|
||||
NSLog(@"WARNING: Thread attempted to recursively lock: %@",self); \
|
||||
} \
|
||||
}
|
||||
|
||||
// NSLock class
|
||||
// Simplest lock for protecting critical sections of code
|
||||
|
||||
|
@ -447,7 +455,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
|||
|
||||
- (BOOL) tryLock
|
||||
{
|
||||
CHECK_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
||||
WARN_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
||||
|
||||
// Ask the runtime to acquire a lock on the mutex
|
||||
if (objc_mutex_trylock(_MUTEX) == -1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue