mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
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:
parent
263e81a85c
commit
ee8b3b987c
5 changed files with 45 additions and 23 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-12-20 Graham Lee <graham@iamleeg.com>
|
||||
|
||||
* Headers/Foundation/NSUUID.h:
|
||||
* Source/NSUUID.m: implemented for unix
|
||||
* Tests/base/NSUUID: testcases
|
||||
|
||||
2013-12-20 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSObject.m: initialise defaults system at end of NSObject
|
||||
|
|
|
@ -77,6 +77,18 @@ GS_EXPORT NSString * const NSDefaultRunLoopMode;
|
|||
|
||||
- (void) run;
|
||||
|
||||
/**
|
||||
* Calls -limitDateForMode: to determine if a timeout occurs before the
|
||||
* specified date, then calls -acceptInputForMode:beforeDate: to run the
|
||||
* loop once.<br />
|
||||
* The specified date may be nil ... in which case the loop runs
|
||||
* until the limit date of the first input or timeout.<br />
|
||||
* If the specified date is in the past, this runs the loop once only,
|
||||
* to handle any events already available.<br />
|
||||
* If there are no input sources or timers in mode, this method
|
||||
* returns NO without running the loop (irrespective of the supplied
|
||||
* date argument), otherwise returns YES.
|
||||
*/
|
||||
- (BOOL) runMode: (NSString*)mode
|
||||
beforeDate: (NSDate*)date;
|
||||
|
||||
|
|
|
@ -25,9 +25,11 @@
|
|||
#ifndef __NSUUID_h_GNUSTEP_BASE_INCLUDE
|
||||
#define __NSUUID_h_GNUSTEP_BASE_INCLUDE
|
||||
|
||||
|
||||
#import <GNUstepBase/GSVersionMacros.h>
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
#if OS_API_VERSION(MAC_OS_X_VERSION_10_8,GS_API_LATEST)
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -60,4 +62,6 @@ typedef uint8_t gsuuid_t[16];
|
|||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* __NSUUID_h_GNUSTEP_BASE_INCLUDE */
|
||||
|
|
|
@ -1240,18 +1240,6 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
|
|||
[arp drain];
|
||||
}
|
||||
|
||||
/**
|
||||
* Calls -limitDateForMode: to determine if a timeout occurs before the
|
||||
* specified date, then calls -acceptInputForMode:beforeDate: to run the
|
||||
* loop once.<br />
|
||||
* The specified date may be nil ... in which case the loop runs
|
||||
* until the limit date of the first input or timeout.<br />
|
||||
* If the specified date is in the past, this runs the loop once only,
|
||||
* to handle any events already available.<br />
|
||||
* If there are no input sources or timers in mode, this method
|
||||
* returns NO without running the loop (irrespective of the supplied
|
||||
* date argument), otherwise returns YES.
|
||||
*/
|
||||
- (BOOL) runMode: (NSString*)mode beforeDate: (NSDate*)date
|
||||
{
|
||||
NSAutoreleasePool *arp = [NSAutoreleasePool new];
|
||||
|
@ -1259,7 +1247,13 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
|
|||
|
||||
NSAssert(mode != nil, NSInvalidArgumentException);
|
||||
|
||||
/* Find out how long we can wait before first limit date. */
|
||||
/* Process any pending notifications.
|
||||
*/
|
||||
GSPrivateCheckTasks();
|
||||
GSPrivateNotifyASAP(mode);
|
||||
|
||||
/* Find out how long we can wait before first limit date.
|
||||
*/
|
||||
d = [self limitDateForMode: mode];
|
||||
if (d == nil)
|
||||
{
|
||||
|
@ -1267,8 +1261,7 @@ updateTimer(NSTimer *t, NSDate *d, NSTimeInterval now)
|
|||
return NO;
|
||||
}
|
||||
|
||||
/*
|
||||
* Use the earlier of the two dates we have.
|
||||
/* Use the earlier of the two dates we have.
|
||||
* Retain the date in case the firing of a timer (or some other event)
|
||||
* releases it.
|
||||
*/
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue