tweak minor problems in last changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@33994 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2011-10-14 16:19:37 +00:00
parent b644d057ee
commit 241155db60
5 changed files with 129 additions and 117 deletions

View file

@ -39,7 +39,9 @@
# #
# Additional flags to pass to the preprocessor # Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) $(WARN_FLAGS) -DNO_GNUSTEP=1 ADDITIONAL_CPPFLAGS = $(DEFS) \
-D_XOPEN_SOURCE=600 \
$(WARN_FLAGS) -DNO_GNUSTEP=1
# Additional flags to pass to the Objective-C compiler # Additional flags to pass to the Objective-C compiler
#ADDITIONAL_OBJCFLAGS = #ADDITIONAL_OBJCFLAGS =

View file

@ -178,10 +178,14 @@ GSRunLoopForThread(NSThread *aThread)
- (const char *) typeForSelector: (SEL)sel remoteTarget: (unsigned)target; - (const char *) typeForSelector: (SEL)sel remoteTarget: (unsigned)target;
@end @end
#define F_LOCK(X) {NSDebugFLLog(@"GSConnection",@"Lock %@",X);[X lock];} #define GS_F_LOCK(X) \
#define F_UNLOCK(X) {NSDebugFLLog(@"GSConnection",@"Unlock %@",X);[X unlock];} {NSDebugFLLog(@"GSConnection",@"Lock %@",X);[X lock];}
#define M_LOCK(X) {NSDebugMLLog(@"GSConnection",@"Lock %@",X);[X lock];} #define GS_F_UNLOCK(X) \
#define M_UNLOCK(X) {NSDebugMLLog(@"GSConnection",@"Unlock %@",X);[X unlock];} {NSDebugFLLog(@"GSConnection",@"Unlock %@",X);[X unlock];}
#define GS_M_LOCK(X) \
{NSDebugMLLog(@"GSConnection",@"Lock %@",X);[X lock];}
#define GSM_UNLOCK(X) \
{NSDebugMLLog(@"GSConnection",@"Unlock %@",X);[X unlock];}
NSString * const NSDestinationInvalidException = NSString * const NSDestinationInvalidException =
@"NSDestinationInvalidException"; @"NSDestinationInvalidException";
@ -377,7 +381,7 @@ existingConnection(NSPort *receivePort, NSPort *sendPort)
NSHashEnumerator enumerator; NSHashEnumerator enumerator;
NSConnection *c; NSConnection *c;
F_LOCK(connection_table_gate); GS_F_LOCK(connection_table_gate);
enumerator = NSEnumerateHashTable(connection_table); enumerator = NSEnumerateHashTable(connection_table);
while ((c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil) while ((c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
{ {
@ -393,7 +397,7 @@ existingConnection(NSPort *receivePort, NSPort *sendPort)
} }
} }
NSEndHashTableEnumeration(&enumerator); NSEndHashTableEnumeration(&enumerator);
F_UNLOCK(connection_table_gate); GS_F_UNLOCK(connection_table_gate);
return c; return c;
} }
@ -405,9 +409,9 @@ rootObjectForInPort(NSPort *aPort)
{ {
id rootObject; id rootObject;
F_LOCK(root_object_map_gate); GS_F_LOCK(root_object_map_gate);
rootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort); rootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort);
F_UNLOCK(root_object_map_gate); GS_F_UNLOCK(root_object_map_gate);
return rootObject; return rootObject;
} }
@ -417,7 +421,7 @@ setRootObjectForInPort(id anObj, NSPort *aPort)
{ {
id oldRootObject; id oldRootObject;
F_LOCK(root_object_map_gate); GS_F_LOCK(root_object_map_gate);
oldRootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort); oldRootObject = (id)NSMapGet(root_object_map, (void*)(uintptr_t)aPort);
if (oldRootObject != anObj) if (oldRootObject != anObj)
{ {
@ -431,7 +435,7 @@ setRootObjectForInPort(id anObj, NSPort *aPort)
NSMapRemove(root_object_map, (void*)(uintptr_t)aPort); NSMapRemove(root_object_map, (void*)(uintptr_t)aPort);
} }
} }
F_UNLOCK(root_object_map_gate); GS_F_UNLOCK(root_object_map_gate);
} }
static NSMapTable *targetToCached = NULL; static NSMapTable *targetToCached = NULL;
@ -457,9 +461,9 @@ static NSLock *cached_proxies_gate = nil;
{ {
NSArray *a; NSArray *a;
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
a = NSAllHashTableObjects(connection_table); a = NSAllHashTableObjects(connection_table);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
return a; return a;
} }
@ -795,7 +799,7 @@ static NSLock *cached_proxies_gate = nil;
NSArray *cached_locals; NSArray *cached_locals;
int i; int i;
M_LOCK(cached_proxies_gate); GS_M_LOCK(cached_proxies_gate);
cached_locals = NSAllMapTableValues(targetToCached); cached_locals = NSAllMapTableValues(targetToCached);
for (i = [cached_locals count]; i > 0; i--) for (i = [cached_locals count]; i > 0; i--)
{ {
@ -814,7 +818,7 @@ static NSLock *cached_proxies_gate = nil;
[t invalidate]; [t invalidate];
timer = nil; timer = nil;
} }
M_UNLOCK(cached_proxies_gate); GSM_UNLOCK(cached_proxies_gate);
} }
/** /**
@ -823,7 +827,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) addRequestMode: (NSString*)mode - (void) addRequestMode: (NSString*)mode
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if ([self isValid] == YES) if ([self isValid] == YES)
{ {
if ([IrequestModes containsObject: mode] == NO) if ([IrequestModes containsObject: mode] == NO)
@ -839,7 +843,7 @@ static NSLock *cached_proxies_gate = nil;
[IrequestModes addObject: mode]; [IrequestModes addObject: mode];
} }
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/** /**
@ -848,7 +852,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) addRunLoop: (NSRunLoop*)loop - (void) addRunLoop: (NSRunLoop*)loop
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if ([self isValid] == YES) if ([self isValid] == YES)
{ {
if ([IrunLoops indexOfObjectIdenticalTo: loop] == NSNotFound) if ([IrunLoops indexOfObjectIdenticalTo: loop] == NSNotFound)
@ -864,7 +868,7 @@ static NSLock *cached_proxies_gate = nil;
[IrunLoops addObject: loop]; [IrunLoops addObject: loop];
} }
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
- (void) dealloc - (void) dealloc
@ -1038,7 +1042,7 @@ static NSLock *cached_proxies_gate = nil;
@"Send: %@\n Recv: %@", parent, self, s, r); @"Send: %@\n Recv: %@", parent, self, s, r);
} }
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
IisValid = YES; IisValid = YES;
IreceivePort = RETAIN(r); IreceivePort = RETAIN(r);
@ -1179,7 +1183,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
if ([del connection: parent shouldMakeNewConnection: self] == NO) if ([del connection: parent shouldMakeNewConnection: self] == NO)
{ {
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
DESTROY(self); DESTROY(self);
return nil; return nil;
} }
@ -1189,7 +1193,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
if (![del makeNewConnection: self sender: parent]) if (![del makeNewConnection: self sender: parent])
{ {
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
DESTROY(self); DESTROY(self);
return nil; return nil;
} }
@ -1223,7 +1227,7 @@ static NSLock *cached_proxies_gate = nil;
implementation of [-release] to automatically remove the connection implementation of [-release] to automatically remove the connection
from this array when it is the only thing retaining it. */ from this array when it is the only thing retaining it. */
NSHashInsert(connection_table, (void*)self); NSHashInsert(connection_table, (void*)self);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
[nCenter postNotificationName: NSConnectionDidInitializeNotification [nCenter postNotificationName: NSConnectionDidInitializeNotification
object: self]; object: self];
@ -1242,10 +1246,10 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) invalidate - (void) invalidate
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IisValid == NO) if (IisValid == NO)
{ {
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return; return;
} }
if (IshuttingDown == NO) if (IshuttingDown == NO)
@ -1258,11 +1262,11 @@ static NSLock *cached_proxies_gate = nil;
//[self _shutdown]; //[self _shutdown];
} }
IisValid = NO; IisValid = NO;
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
NSHashRemove(connection_table, self); NSHashRemove(connection_table, self);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
/* /*
* Don't need notifications any more - so remove self as observer. * Don't need notifications any more - so remove self as observer.
@ -1323,7 +1327,7 @@ static NSLock *cached_proxies_gate = nil;
* these proxies in case they are keeping us retained when we * these proxies in case they are keeping us retained when we
* might otherwise de deallocated. * might otherwise de deallocated.
*/ */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IlocalTargets != 0) if (IlocalTargets != 0)
{ {
NSMutableArray *targets; NSMutableArray *targets;
@ -1371,7 +1375,7 @@ static NSLock *cached_proxies_gate = nil;
NSZoneFree(IlocalObjects->zone, (void*)IlocalObjects); NSZoneFree(IlocalObjects->zone, (void*)IlocalObjects);
IlocalObjects = 0; IlocalObjects = 0;
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
/* /*
* If we are invalidated, we shouldn't be receiving any event and * If we are invalidated, we shouldn't be receiving any event and
@ -1412,7 +1416,7 @@ static NSLock *cached_proxies_gate = nil;
NSMutableArray *c; NSMutableArray *c;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IlocalObjects != 0) if (IlocalObjects != 0)
{ {
GSIMapEnumerator_t enumerator; GSIMapEnumerator_t enumerator;
@ -1432,7 +1436,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
c = [NSArray array]; c = [NSArray array];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return c; return c;
} }
@ -1502,16 +1506,16 @@ static NSLock *cached_proxies_gate = nil;
* it from the table so that no other thread will find it * it from the table so that no other thread will find it
* and try to use it while it is being deallocated. * and try to use it while it is being deallocated.
*/ */
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
if (NSDecrementExtraRefCountWasZero(self)) if (NSDecrementExtraRefCountWasZero(self))
{ {
NSHashRemove(connection_table, self); NSHashRemove(connection_table, self);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
[self dealloc]; [self dealloc];
} }
else else
{ {
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
} }
} }
@ -1524,7 +1528,7 @@ static NSLock *cached_proxies_gate = nil;
NSMutableArray *c; NSMutableArray *c;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IremoteProxies != 0) if (IremoteProxies != 0)
{ {
GSIMapEnumerator_t enumerator; GSIMapEnumerator_t enumerator;
@ -1544,7 +1548,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
c = [NSMutableArray array]; c = [NSMutableArray array];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return c; return c;
} }
@ -1553,7 +1557,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) removeRequestMode: (NSString*)mode - (void) removeRequestMode: (NSString*)mode
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IrequestModes != nil && [IrequestModes containsObject: mode]) if (IrequestModes != nil && [IrequestModes containsObject: mode])
{ {
unsigned c = [IrunLoops count]; unsigned c = [IrunLoops count];
@ -1568,7 +1572,7 @@ static NSLock *cached_proxies_gate = nil;
} }
[IrequestModes removeObject: mode]; [IrequestModes removeObject: mode];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/** /**
@ -1576,7 +1580,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) removeRunLoop: (NSRunLoop*)loop - (void) removeRunLoop: (NSRunLoop*)loop
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IrunLoops != nil) if (IrunLoops != nil)
{ {
unsigned pos = [IrunLoops indexOfObjectIdenticalTo: loop]; unsigned pos = [IrunLoops indexOfObjectIdenticalTo: loop];
@ -1596,7 +1600,7 @@ static NSLock *cached_proxies_gate = nil;
[IrunLoops removeObjectAtIndex: pos]; [IrunLoops removeObjectAtIndex: pos];
} }
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/** /**
@ -1619,9 +1623,9 @@ static NSLock *cached_proxies_gate = nil;
{ {
NSArray *c; NSArray *c;
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
c = AUTORELEASE([IrequestModes copy]); c = AUTORELEASE([IrequestModes copy]);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return c; return c;
} }
@ -1743,7 +1747,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) setRequestMode: (NSString*)mode - (void) setRequestMode: (NSString*)mode
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IrequestModes != nil) if (IrequestModes != nil)
{ {
while ([IrequestModes count] > 0 while ([IrequestModes count] > 0
@ -1760,7 +1764,7 @@ static NSLock *cached_proxies_gate = nil;
[self addRequestMode: mode]; [self addRequestMode: mode];
} }
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/** /**
@ -1830,7 +1834,7 @@ static NSLock *cached_proxies_gate = nil;
d = [NSMutableDictionary dictionaryWithCapacity: 8]; d = [NSMutableDictionary dictionaryWithCapacity: 8];
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
/* /*
* These are in OPENSTEP 4.2 * These are in OPENSTEP 4.2
@ -1859,7 +1863,7 @@ static NSLock *cached_proxies_gate = nil;
o = [NSNumber numberWithUnsignedInt: [IrequestQueue count]]; o = [NSNumber numberWithUnsignedInt: [IrequestQueue count]];
[d setObject: o forKey: @"NSConnectionRequestQueue"]; [d setObject: o forKey: @"NSConnectionRequestQueue"];
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return d; return d;
} }
@ -2047,7 +2051,7 @@ static NSLock *cached_proxies_gate = nil;
* the IreplyMap. However, in case the other end has already sent us * the IreplyMap. However, in case the other end has already sent us
* a response, we must check for it and scrap it if necessary. * a response, we must check for it and scrap it if necessary.
*/ */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)seq); node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)seq);
if (node != 0 && node->value.obj != dummyObject) if (node != 0 && node->value.obj != dummyObject)
{ {
@ -2063,7 +2067,7 @@ static NSLock *cached_proxies_gate = nil;
[self _doneInRmc: node->value.obj]; [self _doneInRmc: node->value.obj];
} }
GSIMapRemoveKey(IreplyMap, (GSIMapKey)(NSUInteger)seq); GSIMapRemoveKey(IreplyMap, (GSIMapKey)(NSUInteger)seq);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
else else
{ {
@ -2211,9 +2215,9 @@ static NSLock *cached_proxies_gate = nil;
{ {
unsigned result; unsigned result;
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
result = NSCountHashTable(connection_table); result = NSCountHashTable(connection_table);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
return result; return result;
} }
@ -2223,7 +2227,7 @@ static NSLock *cached_proxies_gate = nil;
NSHashEnumerator enumerator; NSHashEnumerator enumerator;
NSConnection *o; NSConnection *o;
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
enumerator = NSEnumerateHashTable(connection_table); enumerator = NSEnumerateHashTable(connection_table);
while ((o = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil) while ((o = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
{ {
@ -2233,7 +2237,7 @@ static NSLock *cached_proxies_gate = nil;
} }
} }
NSEndHashTableEnumeration(&enumerator); NSEndHashTableEnumeration(&enumerator);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
return count; return count;
} }
@ -2326,14 +2330,14 @@ static NSLock *cached_proxies_gate = nil;
* If REPLY_DEPTH is non-zero, we may still want to service it now * If REPLY_DEPTH is non-zero, we may still want to service it now
* if independent_queuing is NO. * if independent_queuing is NO.
*/ */
M_LOCK(GSIVar(conn, _refGate)); GS_M_LOCK(GSIVar(conn, _refGate));
if (GSIVar(conn, _requestDepth) == 0 if (GSIVar(conn, _requestDepth) == 0
|| GSIVar(conn, _independentQueueing) == NO) || GSIVar(conn, _independentQueueing) == NO)
{ {
GSIVar(conn, _requestDepth)++; GSIVar(conn, _requestDepth)++;
M_UNLOCK(GSIVar(conn, _refGate)); GSM_UNLOCK(GSIVar(conn, _refGate));
[conn _service_forwardForProxy: rmc]; // Catches exceptions [conn _service_forwardForProxy: rmc]; // Catches exceptions
M_LOCK(GSIVar(conn, _refGate)); GS_M_LOCK(GSIVar(conn, _refGate));
GSIVar(conn, _requestDepth)--; GSIVar(conn, _requestDepth)--;
} }
else else
@ -2349,11 +2353,11 @@ static NSLock *cached_proxies_gate = nil;
{ {
rmc = [GSIVar(conn, _requestQueue) objectAtIndex: 0]; rmc = [GSIVar(conn, _requestQueue) objectAtIndex: 0];
[GSIVar(conn, _requestQueue) removeObjectAtIndex: 0]; [GSIVar(conn, _requestQueue) removeObjectAtIndex: 0];
M_UNLOCK(GSIVar(conn, _refGate)); GSM_UNLOCK(GSIVar(conn, _refGate));
[conn _service_forwardForProxy: rmc]; // Catches exceptions [conn _service_forwardForProxy: rmc]; // Catches exceptions
M_LOCK(GSIVar(conn, _refGate)); GS_M_LOCK(GSIVar(conn, _refGate));
} }
M_UNLOCK(GSIVar(conn, _refGate)); GSM_UNLOCK(GSIVar(conn, _refGate));
break; break;
/* /*
@ -2379,7 +2383,7 @@ static NSLock *cached_proxies_gate = nil;
[self _doneInRmc: rmc]; [self _doneInRmc: rmc];
break; break;
} }
M_LOCK(GSIVar(conn, _refGate)); GS_M_LOCK(GSIVar(conn, _refGate));
node = GSIMapNodeForKey(GSIVar(conn, _replyMap), node = GSIMapNodeForKey(GSIVar(conn, _replyMap),
(GSIMapKey)(NSUInteger)sequence); (GSIMapKey)(NSUInteger)sequence);
if (node == 0) if (node == 0)
@ -2401,7 +2405,7 @@ static NSLock *cached_proxies_gate = nil;
[self _doneInRmc: node->value.obj]; [self _doneInRmc: node->value.obj];
node->value.obj = rmc; node->value.obj = rmc;
} }
M_UNLOCK(GSIVar(conn, _refGate)); GSM_UNLOCK(GSIVar(conn, _refGate));
} }
break; break;
@ -2908,7 +2912,7 @@ static NSLock *cached_proxies_gate = nil;
if (debug_connection > 3) if (debug_connection > 3)
NSLog(@"releasing object with target (0x%x) on (%@) counter %d", NSLog(@"releasing object with target (0x%x) on (%@) counter %d",
target, self, prox->_counter); target, self, prox->_counter);
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
NS_DURING NS_DURING
{ {
if (--(prox->_counter) == 0) if (--(prox->_counter) == 0)
@ -2929,11 +2933,11 @@ static NSLock *cached_proxies_gate = nil;
} }
NS_HANDLER NS_HANDLER
{ {
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
[localException raise]; [localException raise];
} }
NS_ENDHANDLER NS_ENDHANDLER
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
else if (debug_connection > 3) else if (debug_connection > 3)
NSLog(@"releasing object with target (0x%x) on (%@) - nothing to do", NSLog(@"releasing object with target (0x%x) on (%@) - nothing to do",
@ -2962,7 +2966,7 @@ static NSLock *cached_proxies_gate = nil;
NSLog(@"looking to retain local object with target (0x%x) on (%@)", NSLog(@"looking to retain local object with target (0x%x) on (%@)",
target, self); target, self);
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
local = [self locateLocalTarget: target]; local = [self locateLocalTarget: target];
if (local == nil) if (local == nil)
{ {
@ -2972,7 +2976,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
local->_counter++; // Vended on connection. local->_counter++; // Vended on connection.
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
[op encodeObject: response]; [op encodeObject: response];
[self _sendOutRmc: op type: RETAIN_REPLY]; [self _sendOutRmc: op type: RETAIN_REPLY];
@ -3114,14 +3118,14 @@ static NSLock *cached_proxies_gate = nil;
if (debug_connection > 5) if (debug_connection > 5)
NSLog(@"Waiting for reply sequence %d on %@", NSLog(@"Waiting for reply sequence %d on %@",
sn, self); sn, self);
M_LOCK(IrefGate); isLocked = YES; GS_M_LOCK(IrefGate); isLocked = YES;
while (IisValid == YES while (IisValid == YES
&& (node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)sn)) != 0 && (node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)sn)) != 0
&& node->value.obj == dummyObject) && node->value.obj == dummyObject)
{ {
NSDate *limit_date; NSDate *limit_date;
M_UNLOCK(IrefGate); isLocked = NO; GSM_UNLOCK(IrefGate); isLocked = NO;
if (start_date == nil) if (start_date == nil)
{ {
start_date = [dateClass allocWithZone: NSDefaultMallocZone()]; start_date = [dateClass allocWithZone: NSDefaultMallocZone()];
@ -3165,7 +3169,7 @@ static NSLock *cached_proxies_gate = nil;
&& (limit_date == timeout_date)) && (limit_date == timeout_date))
|| [timeout_date timeIntervalSinceNow] <= 0.0) || [timeout_date timeIntervalSinceNow] <= 0.0)
{ {
M_LOCK(IrefGate); isLocked = YES; GS_M_LOCK(IrefGate); isLocked = YES;
node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)sn); node = GSIMapNodeForKey(IreplyMap, (GSIMapKey)(NSUInteger)sn);
break; break;
} }
@ -3175,7 +3179,7 @@ static NSLock *cached_proxies_gate = nil;
NSLog(@"WARNING ... waiting for reply %u since %@ on %@", NSLog(@"WARNING ... waiting for reply %u since %@ on %@",
sn, start_date, self); sn, start_date, self);
} }
M_LOCK(IrefGate); isLocked = YES; GS_M_LOCK(IrefGate); isLocked = YES;
} }
if (node == 0) if (node == 0)
{ {
@ -3186,7 +3190,7 @@ static NSLock *cached_proxies_gate = nil;
rmc = node->value.obj; rmc = node->value.obj;
GSIMapRemoveKey(IreplyMap, (GSIMapKey)(NSUInteger)sn); GSIMapRemoveKey(IreplyMap, (GSIMapKey)(NSUInteger)sn);
} }
M_UNLOCK(IrefGate); isLocked = NO; GSM_UNLOCK(IrefGate); isLocked = NO;
TEST_RELEASE(start_date); TEST_RELEASE(start_date);
TEST_RELEASE(delay_date); TEST_RELEASE(delay_date);
TEST_RELEASE(timeout_date); TEST_RELEASE(timeout_date);
@ -3213,7 +3217,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
if (isLocked == YES) if (isLocked == YES)
{ {
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
[localException raise]; [localException raise];
} }
@ -3231,7 +3235,7 @@ static NSLock *cached_proxies_gate = nil;
- (void) _doneInRmc: (NSPortCoder*)c - (void) _doneInRmc: (NSPortCoder*)c
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (debug_connection > 5) if (debug_connection > 5)
{ {
NSLog(@"done rmc %p", c); NSLog(@"done rmc %p", c);
@ -3242,7 +3246,7 @@ static NSLock *cached_proxies_gate = nil;
} }
[c dispatch]; /* Tell NSPortCoder to release the connection. */ [c dispatch]; /* Tell NSPortCoder to release the connection. */
RELEASE(c); RELEASE(c);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/* /*
@ -3251,7 +3255,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) _failInRmc: (NSPortCoder*)c - (void) _failInRmc: (NSPortCoder*)c
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (cacheCoders == YES && IcachedDecoders != nil if (cacheCoders == YES && IcachedDecoders != nil
&& [IcachedDecoders indexOfObjectIdenticalTo: c] == NSNotFound) && [IcachedDecoders indexOfObjectIdenticalTo: c] == NSNotFound)
{ {
@ -3263,7 +3267,7 @@ static NSLock *cached_proxies_gate = nil;
} }
[c dispatch]; /* Tell NSPortCoder to release the connection. */ [c dispatch]; /* Tell NSPortCoder to release the connection. */
RELEASE(c); RELEASE(c);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
/* /*
@ -3272,7 +3276,7 @@ static NSLock *cached_proxies_gate = nil;
*/ */
- (void) _failOutRmc: (NSPortCoder*)c - (void) _failOutRmc: (NSPortCoder*)c
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (cacheCoders == YES && IcachedEncoders != nil if (cacheCoders == YES && IcachedEncoders != nil
&& [IcachedEncoders indexOfObjectIdenticalTo: c] == NSNotFound) && [IcachedEncoders indexOfObjectIdenticalTo: c] == NSNotFound)
{ {
@ -3280,7 +3284,7 @@ static NSLock *cached_proxies_gate = nil;
} }
[c dispatch]; /* Tell NSPortCoder to release the connection. */ [c dispatch]; /* Tell NSPortCoder to release the connection. */
RELEASE(c); RELEASE(c);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
- (NSPortCoder*) _makeInRmc: (NSMutableArray*)components - (NSPortCoder*) _makeInRmc: (NSMutableArray*)components
@ -3290,7 +3294,7 @@ static NSLock *cached_proxies_gate = nil;
NSParameterAssert(IisValid); NSParameterAssert(IisValid);
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (cacheCoders == YES && IcachedDecoders != nil if (cacheCoders == YES && IcachedDecoders != nil
&& (count = [IcachedDecoders count]) > 0) && (count = [IcachedDecoders count]) > 0)
{ {
@ -3301,7 +3305,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
coder = [recvCoderClass allocWithZone: NSDefaultMallocZone()]; coder = [recvCoderClass allocWithZone: NSDefaultMallocZone()];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
coder = [coder initWithReceivePort: IreceivePort coder = [coder initWithReceivePort: IreceivePort
sendPort:IsendPort sendPort:IsendPort
@ -3325,7 +3329,7 @@ static NSLock *cached_proxies_gate = nil;
NSParameterAssert(IisValid); NSParameterAssert(IisValid);
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
/* /*
* Generate a new sequence number if required. * Generate a new sequence number if required.
*/ */
@ -3355,7 +3359,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
coder = [sendCoderClass allocWithZone: NSDefaultMallocZone()]; coder = [sendCoderClass allocWithZone: NSDefaultMallocZone()];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
coder = [coder initWithReceivePort: IreceivePort coder = [coder initWithReceivePort: IreceivePort
sendPort:IsendPort sendPort:IsendPort
@ -3418,7 +3422,7 @@ static NSLock *cached_proxies_gate = nil;
from: IreceivePort from: IreceivePort
reserved: [IsendPort reservedSpaceLength]]; reserved: [IsendPort reservedSpaceLength]];
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
/* /*
* We replace the coder we have just used in the cache, and tell it not to * We replace the coder we have just used in the cache, and tell it not to
@ -3430,7 +3434,7 @@ static NSLock *cached_proxies_gate = nil;
} }
[c dispatch]; /* Tell NSPortCoder to release the connection. */ [c dispatch]; /* Tell NSPortCoder to release the connection. */
RELEASE(c); RELEASE(c);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
if (sent == NO) if (sent == NO)
{ {
@ -3475,7 +3479,7 @@ static NSLock *cached_proxies_gate = nil;
unsigned target; unsigned target;
GSIMapNode node; GSIMapNode node;
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
NSParameterAssert (IisValid); NSParameterAssert (IisValid);
object = anObj->_object; object = anObj->_object;
@ -3506,7 +3510,7 @@ static NSLock *cached_proxies_gate = nil;
NSLog(@"add local object (%p) target (0x%x) " NSLog(@"add local object (%p) target (0x%x) "
@"to connection (%@)", object, target, self); @"to connection (%@)", object, target, self);
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
- (NSDistantObject*) retainOrAddLocal: (NSDistantObject*)proxy - (NSDistantObject*) retainOrAddLocal: (NSDistantObject*)proxy
@ -3516,7 +3520,7 @@ static NSLock *cached_proxies_gate = nil;
NSDistantObject *p; NSDistantObject *p;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)object); node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)object);
if (node == 0) if (node == 0)
{ {
@ -3532,7 +3536,7 @@ static NSLock *cached_proxies_gate = nil;
p = proxy; p = proxy;
[self addLocalObject: p]; [self addLocalObject: p];
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return p; return p;
} }
@ -3543,7 +3547,7 @@ static NSLock *cached_proxies_gate = nil;
unsigned val = 0; unsigned val = 0;
GSIMapNode node; GSIMapNode node;
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
anObj = prox->_object; anObj = prox->_object;
node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)anObj); node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)anObj);
@ -3567,7 +3571,7 @@ static NSLock *cached_proxies_gate = nil;
CachedLocalObject *item; CachedLocalObject *item;
(prox->_counter) = 0; (prox->_counter) = 0;
M_LOCK(cached_proxies_gate); GS_M_LOCK(cached_proxies_gate);
if (timer == nil) if (timer == nil)
{ {
timer = [NSTimer scheduledTimerWithTimeInterval: 1.0 timer = [NSTimer scheduledTimerWithTimeInterval: 1.0
@ -3578,7 +3582,7 @@ static NSLock *cached_proxies_gate = nil;
} }
item = [CachedLocalObject newWithObject: prox time: 5]; item = [CachedLocalObject newWithObject: prox time: 5];
NSMapInsert(targetToCached, (void*)(uintptr_t)target, item); NSMapInsert(targetToCached, (void*)(uintptr_t)target, item);
M_UNLOCK(cached_proxies_gate); GSM_UNLOCK(cached_proxies_gate);
RELEASE(item); RELEASE(item);
if (debug_connection > 3) if (debug_connection > 3)
NSLog(@"placed local object (%p) target (0x%x) in cache", NSLog(@"placed local object (%p) target (0x%x) in cache",
@ -3600,7 +3604,7 @@ static NSLock *cached_proxies_gate = nil;
NSLog(@"removed local object (%p) target (0x%x) " NSLog(@"removed local object (%p) target (0x%x) "
@"from connection (%@) (ref %d)", anObj, target, self, val); @"from connection (%@) (ref %d)", anObj, target, self, val);
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
- (void) _release_target: (unsigned)target count: (unsigned)number - (void) _release_target: (unsigned)target count: (unsigned)number
@ -3646,7 +3650,7 @@ static NSLock *cached_proxies_gate = nil;
NSDistantObject *proxy = nil; NSDistantObject *proxy = nil;
GSIMapNode node; GSIMapNode node;
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
/* /*
* Try a quick lookup to see if the target references a local object * Try a quick lookup to see if the target references a local object
@ -3667,7 +3671,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
CachedLocalObject *cached; CachedLocalObject *cached;
M_LOCK(cached_proxies_gate); GS_M_LOCK(cached_proxies_gate);
cached = NSMapGet (targetToCached, (void*)(uintptr_t)target); cached = NSMapGet (targetToCached, (void*)(uintptr_t)target);
if (cached != nil) if (cached != nil)
{ {
@ -3682,7 +3686,7 @@ static NSLock *cached_proxies_gate = nil;
if (debug_connection > 3) if (debug_connection > 3)
NSLog(@"target (0x%x) moved from cache", target); NSLog(@"target (0x%x) moved from cache", target);
} }
M_UNLOCK(cached_proxies_gate); GSM_UNLOCK(cached_proxies_gate);
} }
/* /*
@ -3694,14 +3698,14 @@ static NSLock *cached_proxies_gate = nil;
NSHashEnumerator enumerator; NSHashEnumerator enumerator;
NSConnection *c; NSConnection *c;
M_LOCK(connection_table_gate); GS_M_LOCK(connection_table_gate);
enumerator = NSEnumerateHashTable(connection_table); enumerator = NSEnumerateHashTable(connection_table);
while (proxy == nil while (proxy == nil
&& (c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil) && (c = (NSConnection*)NSNextHashEnumeratorItem(&enumerator)) != nil)
{ {
if (c != self && [c isValid] == YES) if (c != self && [c isValid] == YES)
{ {
M_LOCK(GSIVar(c, _refGate)); GS_M_LOCK(GSIVar(c, _refGate));
node = GSIMapNodeForKey(GSIVar(c, _localTargets), node = GSIMapNodeForKey(GSIVar(c, _localTargets),
(GSIMapKey)(NSUInteger)target); (GSIMapKey)(NSUInteger)target);
if (node != 0) if (node != 0)
@ -3731,14 +3735,14 @@ static NSLock *cached_proxies_gate = nil;
GSIMapAddPair(IlocalTargets, GSIMapAddPair(IlocalTargets,
(GSIMapKey)(NSUInteger)target, (GSIMapVal)((id)proxy)); (GSIMapKey)(NSUInteger)target, (GSIMapVal)((id)proxy));
} }
M_UNLOCK(GSIVar(c, _refGate)); GSM_UNLOCK(GSIVar(c, _refGate));
} }
} }
NSEndHashTableEnumeration(&enumerator); NSEndHashTableEnumeration(&enumerator);
M_UNLOCK(connection_table_gate); GSM_UNLOCK(connection_table_gate);
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
if (proxy == nil) if (proxy == nil)
{ {
@ -3750,9 +3754,9 @@ static NSLock *cached_proxies_gate = nil;
- (void) vendLocal: (NSDistantObject*)aProxy - (void) vendLocal: (NSDistantObject*)aProxy
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
aProxy->_counter++; aProxy->_counter++;
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
- (void) acquireProxyForTarget: (unsigned)target - (void) acquireProxyForTarget: (unsigned)target
@ -3761,7 +3765,7 @@ static NSLock *cached_proxies_gate = nil;
GSIMapNode node; GSIMapNode node;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)(NSUInteger)target); node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)(NSUInteger)target);
if (node == 0) if (node == 0)
{ {
@ -3771,7 +3775,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
found = node->value.obj; found = node->value.obj;
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
if (found == nil) if (found == nil)
{ {
NS_DURING NS_DURING
@ -3815,7 +3819,7 @@ static NSLock *cached_proxies_gate = nil;
- (void) removeProxy: (NSDistantObject*)aProxy - (void) removeProxy: (NSDistantObject*)aProxy
{ {
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
if (IisValid == YES) if (IisValid == YES)
{ {
unsigned target; unsigned target;
@ -3840,7 +3844,7 @@ static NSLock *cached_proxies_gate = nil;
[self _release_target: target count: count]; [self _release_target: target count: count];
} }
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
} }
@ -3872,7 +3876,7 @@ static NSLock *cached_proxies_gate = nil;
NSParameterAssert(aProxy == nil || [aProxy connectionForProxy] == self); NSParameterAssert(aProxy == nil || [aProxy connectionForProxy] == self);
NSParameterAssert(aProxy == nil || aTarget == aProxy->_handle); NSParameterAssert(aProxy == nil || aTarget == aProxy->_handle);
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)(NSUInteger)aTarget); node = GSIMapNodeForKey(IremoteProxies, (GSIMapKey)(NSUInteger)aTarget);
if (node == 0) if (node == 0)
{ {
@ -3898,7 +3902,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
p->_counter++; p->_counter++;
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return p; return p;
} }
@ -3908,7 +3912,7 @@ static NSLock *cached_proxies_gate = nil;
GSIMapNode node; GSIMapNode node;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)(NSUInteger)anObj); node = GSIMapNodeForKey(IlocalObjects, (GSIMapKey)(NSUInteger)anObj);
if (node == 0) if (node == 0)
{ {
@ -3918,7 +3922,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
ret = node->value.obj; ret = node->value.obj;
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return ret; return ret;
} }
@ -3928,7 +3932,7 @@ static NSLock *cached_proxies_gate = nil;
GSIMapNode node; GSIMapNode node;
/* Don't assert (IisValid); */ /* Don't assert (IisValid); */
M_LOCK(IrefGate); GS_M_LOCK(IrefGate);
node = GSIMapNodeForKey(IlocalTargets, (GSIMapKey)(NSUInteger)target); node = GSIMapNodeForKey(IlocalTargets, (GSIMapKey)(NSUInteger)target);
if (node == 0) if (node == 0)
{ {
@ -3938,7 +3942,7 @@ static NSLock *cached_proxies_gate = nil;
{ {
ret = node->value.obj; ret = node->value.obj;
} }
M_UNLOCK(IrefGate); GSM_UNLOCK(IrefGate);
return ret; return ret;
} }
@ -3994,9 +3998,9 @@ static NSLock *cached_proxies_gate = nil;
NSEnumerator *enumerator; NSEnumerator *enumerator;
NSConnection *c; NSConnection *c;
M_LOCK (connection_table_gate); GS_M_LOCK (connection_table_gate);
enumerator = [NSAllHashTableObjects(connection_table) objectEnumerator]; enumerator = [NSAllHashTableObjects(connection_table) objectEnumerator];
M_UNLOCK (connection_table_gate); GSM_UNLOCK (connection_table_gate);
/* /*
* We enumerate an array copy of the contents of the hash table * We enumerate an array copy of the contents of the hash table

View file

@ -39,7 +39,9 @@
# #
# Additional flags to pass to the preprocessor # Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) $(WARN_FLAGS) ADDITIONAL_CPPFLAGS = $(DEFS) \
-D_XOPEN_SOURCE=600 \
$(WARN_FLAGS)
# Additional flags to pass to the Objective-C compiler # Additional flags to pass to the Objective-C compiler
#ADDITIONAL_OBJCFLAGS = #ADDITIONAL_OBJCFLAGS =

View file

@ -39,7 +39,9 @@
# #
# Additional flags to pass to the preprocessor # Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) $(WARN_FLAGS) ADDITIONAL_CPPFLAGS = $(DEFS) \
-D_XOPEN_SOURCE=600 \
$(WARN_FLAGS)
# Additional flags to pass to the Objective-C compiler # Additional flags to pass to the Objective-C compiler
#ADDITIONAL_OBJCFLAGS = #ADDITIONAL_OBJCFLAGS =

View file

@ -39,7 +39,9 @@
# #
# Additional flags to pass to the preprocessor # Additional flags to pass to the preprocessor
ADDITIONAL_CPPFLAGS = $(DEFS) $(CONFIG_SYSTEM_DEFS) $(WARN_FLAGS) ADDITIONAL_CPPFLAGS = $(DEFS) \
-D_XOPEN_SOURCE=600 \
$(WARN_FLAGS)
# Additional flags to pass to the Objective-C compiler # Additional flags to pass to the Objective-C compiler
#ADDITIONAL_OBJCFLAGS = #ADDITIONAL_OBJCFLAGS =