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

@ -2,6 +2,12 @@
* Source/NSScanner.m: initialisation fix pointed out by David Ayer
* Source/NSBundle.m: fix for getting class from gnustep bundle
* Source/NSConnection.m: thread deadlock fix based on probelm and
solution supplied by Wim Oudshoorn
* Source/NSArchiver.m:
* Source/NSKeyedArchiver.m:
* Source/NSPortCoder.m: Fix possible problem on 64bit CPUs reported
by Wim.
2006-08-16 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -34,7 +34,7 @@
#define GSI_MAP_RETAIN_VAL(M, X)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr)
#define GSI_MAP_NOCLEAN 1
#include "GNUstepBase/GSIMap.h"

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

View file

@ -42,7 +42,7 @@
#define GSI_MAP_RETAIN_VAL(M, X)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr)
#undef GSI_MAP_NOCLEAN
#include "GNUstepBase/GSIMap.h"

View file

@ -59,7 +59,7 @@
#define GSI_MAP_RETAIN_VAL(M, X)
#define GSI_MAP_RELEASE_VAL(M, X)
#define GSI_MAP_HASH(M, X) ((X).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).uint == (Y).uint)
#define GSI_MAP_EQUAL(M, X,Y) ((X).ptr == (Y).ptr)
#define GSI_MAP_NOCLEAN 1
#include "GNUstepBase/GSIMap.h"