fixes for task notification

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37484 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-12-20 13:32:29 +00:00
parent 263e81a85c
commit ee8b3b987c
5 changed files with 45 additions and 23 deletions

View file

@ -854,14 +854,15 @@ pty_slave(const char* name)
*/
- (void) waitUntilExit
{
CREATE_AUTORELEASE_POOL(arp);
NSRunLoop *loop = [NSRunLoop currentRunLoop];
NSTimer *timer = nil;
NSDate *limit = nil;
IF_NO_GC([[self retain] autorelease];)
while ([self isRunning])
{
NSDate *limit;
/*
* Poll at 0.1 second intervals.
/* Poll at 0.1 second intervals.
*/
limit = [[NSDate alloc] initWithTimeIntervalSinceNow: 0.1];
if (timer == nil)
@ -872,11 +873,17 @@ pty_slave(const char* name)
userInfo: nil
repeats: YES];
}
[[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode
beforeDate: limit];
RELEASE(limit);
[loop runMode: NSDefaultRunLoopMode beforeDate: limit];
DESTROY(limit);
}
[timer invalidate];
/* Run loop one last time (with limit date in past) so that any
* notification about the task ending is sent immediately.
*/
limit = [NSDate dateWithTimeIntervalSinceNow: 0.0];
[loop runMode: NSDefaultRunLoopMode beforeDate: limit];
IF_NO_GC([arp release];)
}
@end