Also -ecDidAwaken

This commit is contained in:
Richard Frith-Macdonald 2017-06-23 13:37:34 +01:00
parent 3e73987c86
commit 91f43e226d
2 changed files with 20 additions and 2 deletions

View file

@ -1002,10 +1002,19 @@ extern NSString* cmdVersion(NSString *ver);
* override this method to perform your initialisation.<br />
* If you are not using -ecRun you should call this method explicitly in your
* own code.<br />
* The default implementation does nothing.
* The default implementation does nothing but record the fact that it has
* been called (for -ecDidAwaken).
*/
- (void) ecAwaken;
/** Returns YES if the base implementation of -ecAwaken has been called,
* NO otherwise. You may use this in conjunction with -ecDoLock and
* -ecUnLock to ensure that you have thread-safe initialisation of your
* program (though the locking is normally unnecessary if -ecAwaken is
* only called from -ecRun).
*/
- (BOOL) ecDidAwaken;
/** Records the timestamp of the latest significant input for this process.
* If when is nil the current timestmp is used.
*/

View file

@ -1646,9 +1646,16 @@ static NSString *noFiles = @"No log files to archive";
return cmdSignalled;
}
static BOOL ecDidAwaken = NO;
- (void) ecAwaken
{
return;
ecDidAwaken = YES;
}
- (BOOL) ecDidAwaken
{
return ecDidAwaken;
}
- (void) ecLoggersChanged: (NSNotification*)n
@ -2418,6 +2425,8 @@ NSLog(@"Ignored attempt to set timer interval to %g ... using 10.0", interval);
NSRunLoop *loop;
NSDate *future;
[self cmdAudit: @"Starting `%@'", [self cmdName]];
/* Called to permit subclasses to initialise before entering run loop.
*/
[self ecAwaken];