mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
Remove a lock that is protecting thread-local storage. Stop leaking NSThread objects that are stored in thread-local storage.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@32070 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
176ac3655e
commit
ae709dcd9a
1 changed files with 2 additions and 5 deletions
|
@ -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;
|
||||||
|
|
||||||
|
@ -305,6 +304,7 @@ static void exitedThread(void *thread)
|
||||||
fprintf(stderr, "WARNING thread %p terminated without calling +exit!\n",
|
fprintf(stderr, "WARNING thread %p terminated without calling +exit!\n",
|
||||||
thread);
|
thread);
|
||||||
}
|
}
|
||||||
|
[(id)thread release];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -458,17 +458,15 @@ unregisterActiveThread(NSThread *thread)
|
||||||
|
|
||||||
if (t == nil)
|
if (t == nil)
|
||||||
{
|
{
|
||||||
[thread_creation_lock lock];
|
|
||||||
t = pthread_getspecific(thread_object_key);
|
t = pthread_getspecific(thread_object_key);
|
||||||
if (t == nil)
|
if (t == nil)
|
||||||
{
|
{
|
||||||
t = [self new];
|
t = [self new];
|
||||||
t->_active = YES;
|
t->_active = YES;
|
||||||
pthread_setspecific(thread_object_key, t);
|
pthread_setspecific(thread_object_key, t);
|
||||||
[thread_creation_lock unlock];
|
[t release];
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
[thread_creation_lock unlock];
|
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -529,7 +527,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…
Reference in a new issue