locking and 64bit cpu encoding fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@23329 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-08-25 15:49:01 +00:00
parent caa74e2108
commit bab9df4952
5 changed files with 22 additions and 11 deletions

View file

@ -3613,23 +3613,28 @@ static void callEncoder (DOContext *ctxt)
*/
+ (void) _threadWillExit: (NSNotification*)notification
{
NSRunLoop *runLoop = GSRunLoopForThread([notification object]);
NSRunLoop *runLoop = GSRunLoopForThread ([notification object]);
if (runLoop != nil)
{
NSHashEnumerator enumerator;
NSEnumerator *enumerator;
NSConnection *c;
M_LOCK(connection_table_gate);
enumerator = NSEnumerateHashTable(connection_table);
while ((c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
M_LOCK (connection_table_gate);
enumerator = [NSAllHashTableObjects(connection_table) objectEnumerator];
M_UNLOCK (connection_table_gate);
/*
* We enumerate an array copy of the contents of the hash table
* as we know we can do that safely outside the locked region.
* The temporary array and the enumerator are autoreleased and
* will be deallocated with the threads autorelease pool.
*/
while ((c = [enumerator nextObject]) != nil)
{
[c removeRunLoop: runLoop];
}
NSEndHashTableEnumeration(&enumerator);
M_UNLOCK(connection_table_gate);
}
}
@end