mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Performance tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21985 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8ea1ca503e
commit
38c6dab94b
3 changed files with 23 additions and 4 deletions
|
@ -217,7 +217,7 @@ static void clean_up_names(void)
|
|||
n = [[self class] _query: name];
|
||||
|
||||
NSDebugLLog(@"NSMessagePort", @"got %@", n);
|
||||
return AUTORELEASE([[NSMessagePort alloc] initWithName: n]);
|
||||
return AUTORELEASE([NSMessagePort newWithName: n]);
|
||||
}
|
||||
|
||||
- (BOOL) registerPort: (NSPort *)port
|
||||
|
|
|
@ -125,7 +125,7 @@ static NSRecursiveLock *messagePortLock = nil;
|
|||
* Maps port name to NSMessagePort objects.
|
||||
*/
|
||||
static NSMapTable *ports = 0;
|
||||
static Class messagePortClass;
|
||||
static Class messagePortClass = 0;
|
||||
|
||||
#if NEED_WORD_ALIGNMENT
|
||||
static unsigned wordAlign;
|
||||
|
@ -186,6 +186,24 @@ static unsigned wordAlign;
|
|||
}
|
||||
}
|
||||
|
||||
+ (id) newWithName: (NSString*)name
|
||||
{
|
||||
NSMessagePort *p;
|
||||
|
||||
M_LOCK(messagePortLock);
|
||||
p = RETAIN((NSMessagePort*)NSMapGet(ports, (void*)name));
|
||||
if (p == nil)
|
||||
{
|
||||
p = [[self alloc] initWithName: name];
|
||||
}
|
||||
else
|
||||
{
|
||||
[p _setupSendPort];
|
||||
}
|
||||
M_UNLOCK(messagePortLock);
|
||||
return p;
|
||||
}
|
||||
|
||||
- (void) addConnection: (NSConnection*)aConnection
|
||||
toRunLoop: (NSRunLoop*)aLoop
|
||||
forMode: (NSString*)aMode
|
||||
|
@ -594,7 +612,7 @@ static unsigned wordAlign;
|
|||
length: 16
|
||||
encoding: NSASCIIStringEncoding];
|
||||
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
||||
rPort = [[NSMessagePort alloc] initWithName: n];
|
||||
rPort = [messagePortClass newWithName: n];
|
||||
RELEASE(n);
|
||||
if (rPort == nil)
|
||||
{
|
||||
|
@ -631,7 +649,7 @@ static unsigned wordAlign;
|
|||
length: 16
|
||||
encoding: NSASCIIStringEncoding];
|
||||
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
||||
p = [[NSMessagePort alloc] initWithName: n];
|
||||
p = [messagePortClass newWithName: n];
|
||||
RELEASE(n);
|
||||
if (p == nil)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue