mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
Name server minor safety and performance tweak
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37956 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d84396b484
commit
c219158181
3 changed files with 22 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2014-06-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* 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 <rfm@gnu.org>
|
2014-06-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* configure.ac: Temporarily add -O0 to turn off optimisation while
|
* configure.ac: Temporarily add -O0 to turn off optimisation while
|
||||||
|
|
|
@ -133,8 +133,13 @@ static NSMapTable *portToNamesMap;
|
||||||
NSEnumerator *files;
|
NSEnumerator *files;
|
||||||
|
|
||||||
serverLock = [NSRecursiveLock new];
|
serverLock = [NSRecursiveLock new];
|
||||||
portToNamesMap = NSCreateMapTable(NSNonRetainedObjectMapKeyCallBacks,
|
/* Use NSNonOwnedPointerMapKeyCallBacks for the ports used as keys
|
||||||
NSObjectMapValueCallBacks, 0);
|
* 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];
|
[self registerAtExit];
|
||||||
|
|
||||||
/* It's possible that an old process, with the same process ID as
|
/* It's possible that an old process, with the same process ID as
|
||||||
|
|
|
@ -590,7 +590,12 @@ typedef enum {
|
||||||
}
|
}
|
||||||
s = (NSSocketPortNameServer*)NSAllocateObject(self, 0,
|
s = (NSSocketPortNameServer*)NSAllocateObject(self, 0,
|
||||||
NSDefaultMallocZone());
|
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);
|
NSObjectMapValueCallBacks, 0);
|
||||||
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
s->_nameMap = NSCreateMapTable(NSObjectMapKeyCallBacks,
|
||||||
NSNonOwnedPointerMapValueCallBacks, 0);
|
NSNonOwnedPointerMapValueCallBacks, 0);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue