Fix notification usage.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4410 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-06-16 10:23:33 +00:00
parent 05f1c5e2a4
commit a9c28e8013
3 changed files with 26 additions and 22 deletions

View file

@ -903,7 +903,8 @@ static int messages_received_count;
outPort: (NSPort*)op outPort: (NSPort*)op
ancestorConnection: (NSConnection*)ancestor ancestorConnection: (NSConnection*)ancestor
{ {
NSConnection *newConn; NSNotificationCenter *nCenter;
NSConnection *newConn;
NSParameterAssert (ip); NSParameterAssert (ip);
@ -1034,15 +1035,16 @@ static int messages_received_count;
/* Register ourselves for invalidation notification when the /* Register ourselves for invalidation notification when the
ports become invalid. */ ports become invalid. */
[NSNotificationCenter addObserver: newConn nCenter = [NSNotificationCenter defaultCenter];
selector: @selector(portIsInvalid:) [nCenter addObserver: newConn
name: NSPortDidBecomeInvalidNotification selector: @selector(portIsInvalid:)
object: ip]; name: NSPortDidBecomeInvalidNotification
object: ip];
if (op) if (op)
[NSNotificationCenter addObserver: newConn [nCenter addObserver: newConn
selector: @selector(portIsInvalid:) selector: @selector(portIsInvalid:)
name: NSPortDidBecomeInvalidNotification name: NSPortDidBecomeInvalidNotification
object: op]; object: op];
/* if OP is nil, making this notification request would have /* if OP is nil, making this notification request would have
registered us to receive all NSPortDidBecomeInvalidNotification registered us to receive all NSPortDidBecomeInvalidNotification
requests, independent of which port posted them. This isn't requests, independent of which port posted them. This isn't

View file

@ -787,6 +787,7 @@ static NSPortNameServer *defaultServer = nil;
- (void) _open: (NSString*)host - (void) _open: (NSString*)host
{ {
NSNotificationCenter *nc;
NSRunLoop *loop; NSRunLoop *loop;
NSString *hostname = host; NSString *hostname = host;
BOOL isLocal = NO; BOOL isLocal = NO;
@ -870,18 +871,19 @@ static NSPortNameServer *defaultServer = nil;
expecting = 1; expecting = 1;
[handle retain]; [handle retain];
[NSNotificationCenter addObserver: self nc = [NSNotificationCenter defaultCenter];
selector: @selector(_didConnect:) [nc addObserver: self
name: GSFileHandleConnectCompletionNotification selector: @selector(_didConnect:)
object: handle]; name: GSFileHandleConnectCompletionNotification
[NSNotificationCenter addObserver: self object: handle];
selector: @selector(_didRead:) [nc addObserver: self
name: NSFileHandleReadCompletionNotification selector: @selector(_didRead:)
object: handle]; name: NSFileHandleReadCompletionNotification
[NSNotificationCenter addObserver: self object: handle];
selector: @selector(_didWrite:) [nc addObserver: self
name: GSFileHandleWriteCompletionNotification selector: @selector(_didWrite:)
object: handle]; name: GSFileHandleWriteCompletionNotification
object: handle];
loop = [NSRunLoop currentRunLoop]; loop = [NSRunLoop currentRunLoop];
[loop runMode: mode [loop runMode: mode
beforeDate: [NSDate dateWithTimeIntervalSinceNow: connectTimeout]]; beforeDate: [NSDate dateWithTimeIntervalSinceNow: connectTimeout]];

View file

@ -698,7 +698,7 @@ deserializeFromInfo(_NSDeserializerInfo* info)
} }
else else
{ {
[NSNotificationCenter [[NSNotificationCenter defaultCenter]
addObserver: self addObserver: self
selector: @selector(_becomeThreaded:) selector: @selector(_becomeThreaded:)
name: NSWillBecomeMultiThreadedNotification name: NSWillBecomeMultiThreadedNotification