From c6ee0fb05921d5dc262542db571c2016d94e51ed Mon Sep 17 00:00:00 2001 From: richard Date: Wed, 14 Apr 1999 14:13:20 +0000 Subject: [PATCH] Don't suspend thread when we don't have to. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@4079 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Source/NSDistributedNotificationCenter.m | 13 ++++++++----- Source/NSPortNameServer.m | 11 +++++++---- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 11af12aa1..ad38534b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Apr 14 14:32:00 1999 Richard Frith-Macdonald + + * Source/NSPortNameServer.m: Don't suspend thread while waiting for + gdomap to start up. + * Source/NSDistributedNotificationCenter.m: Don't suspend thread while + waiting for gdnc to start up. + Wed Apr 14 10:50:00 1999 Richard Frith-Macdonald * Source/NSBundle: ([+allBundles]) implemented (ignoring the frameworks diff --git a/Source/NSDistributedNotificationCenter.m b/Source/NSDistributedNotificationCenter.m index a001ab3f0..93e761412 100644 --- a/Source/NSDistributedNotificationCenter.m +++ b/Source/NSDistributedNotificationCenter.m @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -40,8 +40,8 @@ * message about it - they include installation path information. */ #define stringify_it(X) #X -#define make_gdnc_cmd(X) stringify_it(X) "/Tools/" GNUSTEP_TARGET_DIR "/gdnc" -#define make_gdnc_err(X) "check that " stringify_it(X) "/Tools/" GNUSTEP_TARGET_DIR "/gdnc is running." +#define make_gdnc_cmd(X) stringify_it(X) "/Tools/gdnc" +#define make_gdnc_err(X) "check that " stringify_it(X) "/Tools/gdnc is running." /* * Global variables for distributed notification center types. @@ -347,8 +347,11 @@ static NSDistributedNotificationCenter *defCenter = nil; NSLog(@"NSDistributedNotificationCenter failed to contact GDNC server.\n"); NSLog(@"Attempting to start GDNC process - this will take several seconds.\n"); [NSTask launchedTaskWithLaunchPath: cmd arguments: nil]; - [NSThread sleepUntilDate: - [NSDate dateWithTimeIntervalSinceNow: 8.0]]; + [NSTimer scheduledTimerWithTimeInterval: 5.0 + invocation: nil + repeats: NO]; + [[NSRunLoop currentRunLoop] runUntilDate: + [NSDate dateWithTimeIntervalSinceNow: 5.0]]; NSLog(@"Retrying connection to the GDNC server.\n"); recursion = YES; [self _connect]; diff --git a/Source/NSPortNameServer.m b/Source/NSPortNameServer.m index 66d2f82e7..9b591bcc5 100644 --- a/Source/NSPortNameServer.m +++ b/Source/NSPortNameServer.m @@ -36,7 +36,6 @@ #include #include #include -#include #include #include @@ -50,8 +49,8 @@ * message about it - they include installation path information. */ #define stringify_it(X) #X -#define make_gdomap_cmd(X) stringify_it(X) "/Tools/"GNUSTEP_TARGET_DIR"/gdomap" -#define make_gdomap_err(X) "check that " stringify_it(X) "/Tools/"GNUSTEP_TARGET_DIR"/gdomap is running and owned by root." +#define make_gdomap_cmd(X) stringify_it(X) "/Tools/gdomap" +#define make_gdomap_err(X) "check that " stringify_it(X) "/Tools/gdomap is running and owned by root." #define make_gdomap_port(X) stringify_it(X) /* @@ -929,7 +928,11 @@ static NSPortNameServer *defaultServer = nil; cmd = [NSString stringWithCString: make_gdomap_cmd(GNUSTEP_INSTALL_PREFIX)]; NSLog(@"NSPortNameServer attempting to start gdomap on local host"); [NSTask launchedTaskWithLaunchPath: cmd arguments: nil]; - [NSThread sleepUntilDate: [NSDate dateWithTimeIntervalSinceNow: 5.0]]; + [NSTimer scheduledTimerWithTimeInterval: 5.0 + invocation: nil + repeats: NO]; + [[NSRunLoop currentRunLoop] runUntilDate: + [NSDate dateWithTimeIntervalSinceNow: 5.0]]; NSLog(@"NSPortNameServer retrying connection attempt to gdomap"); [self _open: nil]; }