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,6 +903,7 @@ static int messages_received_count;
outPort: (NSPort*)op outPort: (NSPort*)op
ancestorConnection: (NSConnection*)ancestor ancestorConnection: (NSConnection*)ancestor
{ {
NSNotificationCenter *nCenter;
NSConnection *newConn; NSConnection *newConn;
NSParameterAssert (ip); NSParameterAssert (ip);
@ -1034,12 +1035,13 @@ 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];
[nCenter addObserver: newConn
selector: @selector(portIsInvalid:) selector: @selector(portIsInvalid:)
name: NSPortDidBecomeInvalidNotification name: NSPortDidBecomeInvalidNotification
object: ip]; 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];

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,15 +871,16 @@ static NSPortNameServer *defaultServer = nil;
expecting = 1; expecting = 1;
[handle retain]; [handle retain];
[NSNotificationCenter addObserver: self nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self
selector: @selector(_didConnect:) selector: @selector(_didConnect:)
name: GSFileHandleConnectCompletionNotification name: GSFileHandleConnectCompletionNotification
object: handle]; object: handle];
[NSNotificationCenter addObserver: self [nc addObserver: self
selector: @selector(_didRead:) selector: @selector(_didRead:)
name: NSFileHandleReadCompletionNotification name: NSFileHandleReadCompletionNotification
object: handle]; object: handle];
[NSNotificationCenter addObserver: self [nc addObserver: self
selector: @selector(_didWrite:) selector: @selector(_didWrite:)
name: GSFileHandleWriteCompletionNotification name: GSFileHandleWriteCompletionNotification
object: handle]; object: handle];

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