diff --git a/Source/NSThread.m b/Source/NSThread.m index 04eb388ed..a77a2282d 100644 --- a/Source/NSThread.m +++ b/Source/NSThread.m @@ -277,7 +277,6 @@ commonModes(void) static BOOL entered_multi_threaded_state = NO; static NSThread *defaultThread; -static NSLock *thread_creation_lock; static pthread_key_t thread_object_key; @@ -305,6 +304,7 @@ static void exitedThread(void *thread) fprintf(stderr, "WARNING thread %p terminated without calling +exit!\n", thread); } + [(id)thread release]; } /** @@ -458,17 +458,15 @@ unregisterActiveThread(NSThread *thread) if (t == nil) { - [thread_creation_lock lock]; t = pthread_getspecific(thread_object_key); if (t == nil) { t = [self new]; t->_active = YES; pthread_setspecific(thread_object_key, t); - [thread_creation_lock unlock]; + [t release]; return YES; } - [thread_creation_lock unlock]; } return NO; } @@ -529,7 +527,6 @@ unregisterActiveThread(NSThread *thread) [NSException raise: NSInternalInconsistencyException format: @"Unable to create thread key!"]; } - thread_creation_lock = [NSLock new]; /* * Ensure that the default thread exists. */