Fixed task notification problem in nsrunloop

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10219 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-06-21 04:49:20 +00:00
parent 816ac32988
commit 45a8b10e5b
4 changed files with 120 additions and 22 deletions

View file

@ -50,6 +50,7 @@
static int debug_run_loop = 0;
static NSDate *theFuture = nil;
extern BOOL GSCheckTasks();
/*
@ -1016,7 +1017,6 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
- (void) acceptInputForMode: (NSString*)mode
beforeDate: limit_date
{
extern BOOL GSCheckTasks();
NSTimeInterval ti;
struct timeval timeout;
void *select_timeout;
@ -1059,6 +1059,7 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
{
/* The LIMIT_DATE has already past; return immediately without
polling any inputs. */
GSCheckTasks();
[self _checkPerformers];
GSNotifyASAP();
if (debug_run_loop)
@ -1352,6 +1353,13 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
{
printf ("\tNSRunLoop run mode with date already past\n");
}
/*
* Notify if any tasks have completed.
*/
if (GSCheckTasks() == YES)
{
GSNotifyASAP();
}
return NO;
}
@ -1363,6 +1371,13 @@ const NSMapTableValueCallBacks ArrayMapValueCallBacks =
{
printf ("\tNSRunLoop run mode with nothing to do\n");
}
/*
* Notify if any tasks have completed.
*/
if (GSCheckTasks() == YES)
{
GSNotifyASAP();
}
return NO;
}

View file

@ -515,6 +515,8 @@ pty_slave(const char* name)
- (void) waitUntilExit
{
NSTimer *timer = nil;
while ([self isRunning])
{
NSDate *limit;
@ -523,10 +525,19 @@ pty_slave(const char* name)
* Poll at 0.1 second intervals.
*/
limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.1];
if (timer = nil)
{
timer = [NSTimer scheduledTimerWithTimeInterval: 0.1
target: nil
selector: @selector(class)
userInfo: nil
repeats: YES];
}
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate: limit];
RELEASE(limit);
}
[timer invalidate];
}
@end