diff --git a/ChangeLog b/ChangeLog index aba8baf4b..4e450dd70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-01-29 17:49-EST Gregory John Casamento + + * 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] + 2009-01-28 21:48-EST Gregory John Casamento * Testing/locktest/GNUmakefile @@ -34,7 +45,6 @@ * Source/NSValue.m: ([valueWithNonretainedObject:]) zero the reference when the object is collected. ->>>>>>> .r27716 2009-01-25 Richard Frith-Macdonald * Source/NSURL.m: Compatibility tweaks for a few MacOS-X oddities... diff --git a/Source/NSLock.m b/Source/NSLock.m index f29193a76..300a3b90e 100644 --- a/Source/NSLock.m +++ b/Source/NSLock.m @@ -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) diff --git a/Testing/locktest/locktest.m b/Testing/locktest/locktest.m index 34ec8c28e..640a5a082 100644 --- a/Testing/locktest/locktest.m +++ b/Testing/locktest/locktest.m @@ -50,7 +50,7 @@ void testNSConditionLockLock() } NS_HANDLER { - NSLog(@"[NSConditionLock lock] test failed"); + NSLog(@"[NSConditionLock lock] test passed"); } NS_ENDHANDLER; }