mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
Avoid some locking
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32086 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5c18f6ccbb
commit
5ba9e86ee3
2 changed files with 8 additions and 13 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSThread.m: Avoid some unnecessary locking.
|
||||||
|
|
||||||
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
2011-02-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* libs/base/trunk/Source/GSPrivate.h: Fixed the new GS_BEGINITEMBUF()
|
* libs/base/trunk/Source/GSPrivate.h: Fixed the new GS_BEGINITEMBUF()
|
||||||
|
|
|
@ -277,7 +277,6 @@ commonModes(void)
|
||||||
static BOOL entered_multi_threaded_state = NO;
|
static BOOL entered_multi_threaded_state = NO;
|
||||||
|
|
||||||
static NSThread *defaultThread;
|
static NSThread *defaultThread;
|
||||||
static NSLock *thread_creation_lock;
|
|
||||||
|
|
||||||
static pthread_key_t thread_object_key;
|
static pthread_key_t thread_object_key;
|
||||||
|
|
||||||
|
@ -458,17 +457,10 @@ unregisterActiveThread(NSThread *thread)
|
||||||
|
|
||||||
if (t == nil)
|
if (t == nil)
|
||||||
{
|
{
|
||||||
[thread_creation_lock lock];
|
t = [self new];
|
||||||
t = pthread_getspecific(thread_object_key);
|
t->_active = YES;
|
||||||
if (t == nil)
|
pthread_setspecific(thread_object_key, t);
|
||||||
{
|
return YES;
|
||||||
t = [self new];
|
|
||||||
t->_active = YES;
|
|
||||||
pthread_setspecific(thread_object_key, t);
|
|
||||||
[thread_creation_lock unlock];
|
|
||||||
return YES;
|
|
||||||
}
|
|
||||||
[thread_creation_lock unlock];
|
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -529,7 +521,6 @@ unregisterActiveThread(NSThread *thread)
|
||||||
[NSException raise: NSInternalInconsistencyException
|
[NSException raise: NSInternalInconsistencyException
|
||||||
format: @"Unable to create thread key!"];
|
format: @"Unable to create thread key!"];
|
||||||
}
|
}
|
||||||
thread_creation_lock = [NSLock new];
|
|
||||||
/*
|
/*
|
||||||
* Ensure that the default thread exists.
|
* Ensure that the default thread exists.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue