mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +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
252b778407
commit
e848a285c4
3 changed files with 23 additions and 4 deletions
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
@interface NSMessagePort(Private)
|
@interface NSMessagePort(Private)
|
||||||
|
+ (id) newWithName: (NSString*)name;
|
||||||
- (id) initWithName: (NSString*)name;
|
- (id) initWithName: (NSString*)name;
|
||||||
- (NSString*) name;
|
- (NSString*) name;
|
||||||
- (void) receivedEventRead;
|
- (void) receivedEventRead;
|
||||||
|
|
|
@ -217,7 +217,7 @@ static void clean_up_names(void)
|
||||||
n = [[self class] _query: name];
|
n = [[self class] _query: name];
|
||||||
|
|
||||||
NSDebugLLog(@"NSMessagePort", @"got %@", n);
|
NSDebugLLog(@"NSMessagePort", @"got %@", n);
|
||||||
return AUTORELEASE([[NSMessagePort alloc] initWithName: n]);
|
return AUTORELEASE([NSMessagePort newWithName: n]);
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) registerPort: (NSPort *)port
|
- (BOOL) registerPort: (NSPort *)port
|
||||||
|
|
|
@ -125,7 +125,7 @@ static NSRecursiveLock *messagePortLock = nil;
|
||||||
* Maps port name to NSMessagePort objects.
|
* Maps port name to NSMessagePort objects.
|
||||||
*/
|
*/
|
||||||
static NSMapTable *ports = 0;
|
static NSMapTable *ports = 0;
|
||||||
static Class messagePortClass;
|
static Class messagePortClass = 0;
|
||||||
|
|
||||||
#if NEED_WORD_ALIGNMENT
|
#if NEED_WORD_ALIGNMENT
|
||||||
static unsigned wordAlign;
|
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
|
- (void) addConnection: (NSConnection*)aConnection
|
||||||
toRunLoop: (NSRunLoop*)aLoop
|
toRunLoop: (NSRunLoop*)aLoop
|
||||||
forMode: (NSString*)aMode
|
forMode: (NSString*)aMode
|
||||||
|
@ -594,7 +612,7 @@ static unsigned wordAlign;
|
||||||
length: 16
|
length: 16
|
||||||
encoding: NSASCIIStringEncoding];
|
encoding: NSASCIIStringEncoding];
|
||||||
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
||||||
rPort = [[NSMessagePort alloc] initWithName: n];
|
rPort = [messagePortClass newWithName: n];
|
||||||
RELEASE(n);
|
RELEASE(n);
|
||||||
if (rPort == nil)
|
if (rPort == nil)
|
||||||
{
|
{
|
||||||
|
@ -631,7 +649,7 @@ static unsigned wordAlign;
|
||||||
length: 16
|
length: 16
|
||||||
encoding: NSASCIIStringEncoding];
|
encoding: NSASCIIStringEncoding];
|
||||||
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
NSDebugFLLog(@"NSMessagePort", @"Decoded port as '%@'", n);
|
||||||
p = [[NSMessagePort alloc] initWithName: n];
|
p = [messagePortClass newWithName: n];
|
||||||
RELEASE(n);
|
RELEASE(n);
|
||||||
if (p == nil)
|
if (p == nil)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue