Author: rfm
Date: Fri Jun 20 16:17:17 2014
New Revision: 37956
URL: http://svn.gna.org/viewcvs/gnustep?rev=37956&view=rev
Log:
Name server minor safety and performance tweak
Modified:
libs/base/trunk/ChangeLog
libs/base/trunk/Source/NSMessagePortNameServer.m
libs/base/trunk/Source/NSSocketPortNameServer.m
Modified: libs/base/trunk/ChangeLog
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=37956&r1=37955&r2=37956&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog (original)
+++ libs/base/trunk/ChangeLog Fri Jun 20 16:17:17 2014
@@ -1,3 +1,12 @@
+2014-06-20 Richard Frith-Macdonald <[email protected]>
+
+ * Source/NSSocketPortNameServer.m:
+ * Source/NSMessagePortNameServer.m:
+ Maps of ports to names modified to treat the ports as non owned
+ pointers rather than non retained objects ... so we simply do
+ pointer comparisons (faster and also safer if we are removing
+ a port which is being deallocated).
+
2014-06-20 Richard Frith-Macdonald <[email protected]>
* configure.ac: Temporarily add -O0 to turn off optimisation while
Modified: libs/base/trunk/Source/NSMessagePortNameServer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSMessagePortNameServer.m?rev=37956&r1=37955&r2=37956&view=diff
==============================================================================
--- libs/base/trunk/Source/NSMessagePortNameServer.m (original)
+++ libs/base/trunk/Source/NSMessagePortNameServer.m Fri Jun 20 16:17:17 2014
@@ -133,8 +133,13 @@
NSEnumerator *files;
serverLock = [NSRecursiveLock new];
- portToNamesMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
- NSObjectMapValueCallBacks, 0);
+ /* Use NSNonOwnedPointerMapKeyCallBacks for the ports used as keys
+ * since we want as pointer test for equality as we may be doing
+ * lookup while dealocating the port (in which case the -isEqual:
+ * method could fail).
+ */
+ portToNamesMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
+ NSObjectMapValueCallBacks, 0);
[self registerAtExit];
/* It's possible that an old process, with the same process ID as
Modified: libs/base/trunk/Source/NSSocketPortNameServer.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/NSSocketPortNameServer.m?rev=37956&r1=37955&r2=37956&view=diff
==============================================================================
--- libs/base/trunk/Source/NSSocketPortNameServer.m (original)
+++ libs/base/trunk/Source/NSSocketPortNameServer.m Fri Jun 20 16:17:17 2014
@@ -590,7 +590,12 @@
}
s = (NSSocketPortNameServer*)NSAllocateObject(self, 0,
NSDefaultMallocZone());
- s->_portMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
+ /* Use NSNonOwnedPointerMapKeyCallBacks for the ports used as keys
+ * since we want as pointer test for equality as we may be doing
+ * lookup while dealocating the port (in which case the -isEqual:
+ * method could fail).
+ */
+ s->_portMap = NSCreateMapTable(NSNonOwnedPointerMapKeyCallBacks,
NSObjectMapValueCallBacks, 0);
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
NSNonOwnedPointerMapValueCallBacks, 0);
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs