mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-12 17:11:12 +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
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2009-01-28 21:48-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||||
|
|
||||||
* Testing/locktest/GNUmakefile
|
* Testing/locktest/GNUmakefile
|
||||||
|
@ -34,7 +45,6 @@
|
||||||
* Source/NSValue.m: ([valueWithNonretainedObject:]) zero the reference
|
* Source/NSValue.m: ([valueWithNonretainedObject:]) zero the reference
|
||||||
when the object is collected.
|
when the object is collected.
|
||||||
|
|
||||||
>>>>>>> .r27716
|
|
||||||
2009-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
2009-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSURL.m: Compatibility tweaks for a few MacOS-X oddities...
|
* Source/NSURL.m: Compatibility tweaks for a few MacOS-X oddities...
|
||||||
|
|
|
@ -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
|
// NSLock class
|
||||||
// Simplest lock for protecting critical sections of code
|
// Simplest lock for protecting critical sections of code
|
||||||
|
|
||||||
|
@ -447,7 +455,7 @@ NSString *NSRecursiveLockException = @"NSRecursiveLockException";
|
||||||
|
|
||||||
- (BOOL) tryLock
|
- (BOOL) tryLock
|
||||||
{
|
{
|
||||||
CHECK_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
WARN_RECURSIVE_CONDITION_LOCK(_MUTEX);
|
||||||
|
|
||||||
// Ask the runtime to acquire a lock on the mutex
|
// Ask the runtime to acquire a lock on the mutex
|
||||||
if (objc_mutex_trylock(_MUTEX) == -1)
|
if (objc_mutex_trylock(_MUTEX) == -1)
|
||||||
|
|
|
@ -50,7 +50,7 @@ void testNSConditionLockLock()
|
||||||
}
|
}
|
||||||
NS_HANDLER
|
NS_HANDLER
|
||||||
{
|
{
|
||||||
NSLog(@"[NSConditionLock lock] test failed");
|
NSLog(@"[NSConditionLock lock] test passed");
|
||||||
}
|
}
|
||||||
NS_ENDHANDLER;
|
NS_ENDHANDLER;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue