* 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:
Gregory John Casamento 2009-01-29 23:01:51 +00:00
parent ff04c91300
commit f77a3d4091
3 changed files with 21 additions and 3 deletions

View file

@ -1,3 +1,14 @@
2009-01-29 17:49-EST Gregory John Casamento <greg_casamento@yahoo.com>
* 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 <greg_casamento@yahoo.com>
* 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 <rfm@gnu.org>
* Source/NSURL.m: Compatibility tweaks for a few MacOS-X oddities...

View file

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

View file

@ -50,7 +50,7 @@ void testNSConditionLockLock()
}
NS_HANDLER
{
NSLog(@"[NSConditionLock lock] test failed");
NSLog(@"[NSConditionLock lock] test passed");
}
NS_ENDHANDLER;
}