mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-20 18:32:09 +00:00
Twaek for improved flexiblity when shutting down
This commit is contained in:
parent
b3e7848177
commit
8a27be3872
3 changed files with 22 additions and 6 deletions
|
@ -1,3 +1,11 @@
|
|||
2019-07-12 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcProcess.h:
|
||||
* EcProcess.m:
|
||||
Have ecHandleQuit call ecDidQuit in the main thread. That way an
|
||||
application can make the handling run in one thread, and still
|
||||
have the final shutdown done in the main thread.
|
||||
|
||||
2019-05-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcProcess.h:
|
||||
|
|
|
@ -618,8 +618,9 @@ extern NSString* cmdVersion(NSString *ver);
|
|||
/** Called once other stages of a graceful shutdown has completed in
|
||||
* order to perform final cleanup and have the process exit with the
|
||||
* expected status.<br />
|
||||
* Called automatically but subclasses overriding -ecHandleQuit may
|
||||
* call it explicitly at the end of the handling process.
|
||||
* Called automatically in the main thread by the -ecHandleQuit method.
|
||||
* Subclasses overriding -ecHandleQuit must call the superclass
|
||||
* implementation at the end of their handling code.
|
||||
*/
|
||||
- (oneway void) ecDidQuit;
|
||||
|
||||
|
@ -647,7 +648,7 @@ extern NSString* cmdVersion(NSString *ver);
|
|||
* Subclasses should not normally override this method. Instead override
|
||||
* the -ecHandleQuit method.<br />
|
||||
* For backward compatibility, this will call the -cmdQuit: method if a
|
||||
* subclass has overriden it.
|
||||
* subclass has overridden it.
|
||||
*/
|
||||
- (oneway void) ecQuitFor: (NSString*)reason with: (NSInteger)status;
|
||||
|
||||
|
|
13
EcProcess.m
13
EcProcess.m
|
@ -267,11 +267,12 @@ static NSTimeInterval initAt = 0.0;
|
|||
/* Internal value for use only by quitting mechanism.
|
||||
*/
|
||||
static NSTimeInterval beganQuitting = 0.0; // Start of orderly shutdown
|
||||
static BOOL ecQuitHandled = NO; // Has ecHandleQuit run?
|
||||
static NSInteger ecQuitStatus = -1; // Status for the quit
|
||||
static NSString *ecQuitReason = nil; // Reason for the quit
|
||||
static BOOL ecWillAbort = NO; // Abort on next quit
|
||||
|
||||
/* Test to see if the process is tryiung to quit gracefully.
|
||||
/* Test to see if the process is trying to quit gracefully.
|
||||
* If quitting has taken over three minutes, abort immediately.
|
||||
*/
|
||||
static BOOL
|
||||
|
@ -1996,7 +1997,6 @@ static NSString *noFiles = @"No log files to archive";
|
|||
else
|
||||
{
|
||||
[self ecHandleQuit];
|
||||
[self ecDidQuit];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2628,7 +2628,14 @@ static BOOL ecDidAwaken = NO;
|
|||
|
||||
- (void) ecHandleQuit
|
||||
{
|
||||
return;
|
||||
if (NO == ecIsQuitting())
|
||||
{
|
||||
[self ecWillQuit];
|
||||
}
|
||||
ecQuitHandled = YES;
|
||||
[self performSelectorOnMainThread: @selector(ecDidQuit)
|
||||
withObject: nil
|
||||
waitUntilDone: NO];
|
||||
}
|
||||
|
||||
- (BOOL) ecIsQuitting
|
||||
|
|
Loading…
Reference in a new issue