Minor thread tidyup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20155 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2004-09-27 08:59:04 +00:00
parent 485e7f8ece
commit 61fade5ef4
2 changed files with 11 additions and 6 deletions

View file

@ -53,6 +53,8 @@
@class GSPerformHolder;
typedef struct { @defs(NSThread) } NSThread_ivars;
static Class threadClass = Nil;
static NSNotificationCenter *nc = nil;
@ -261,7 +263,8 @@ GSCurrentThread(void)
}
/**
* Fast access function for thread dictionary of current thread.
* Fast access function for thread dictionary of current thread.<br />
* If there is no dictionary, and the thread is active, creates the dictionary.
*/
NSMutableDictionary*
GSDictionaryForThread(NSThread *t)
@ -278,7 +281,7 @@ GSDictionaryForThread(NSThread *t)
{
NSMutableDictionary *dict = t->_thread_dictionary;
if (dict == nil)
if (dict == nil && ((NSThread_ivars *)t)->_active == YES)
{
dict = [t threadDictionary];
}
@ -313,7 +316,9 @@ NSTimer *GSHousekeeper(void)
/**
* Returns the runloop for the specified thread (or, if t is nil,
* for the current thread). Creates a new runloop if necessary.<br />
* for the current thread).<br />
* Creates a new runloop if necessary,
* as long as the thread dictionary exists.<br />
* Returns nil on failure.
*/
NSRunLoop*
@ -1066,9 +1071,6 @@ static NSDate *theFuture;
}
@end
typedef struct { @defs(NSThread) } NSThread_ivars;
/**
* <p>
* This function is provided to let threads started by some other