Author: rfm
Date: Sat May 17 00:13:43 2014
New Revision: 37889

URL: http://svn.gna.org/viewcvs/gnustep?rev=37889&view=rev
Log:
tweak

Modified:
    libs/ec/trunk/ChangeLog
    libs/ec/trunk/EcProcess.m

Modified: libs/ec/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/ChangeLog?rev=37889&r1=37888&r2=37889&view=diff
==============================================================================
--- libs/ec/trunk/ChangeLog     (original)
+++ libs/ec/trunk/ChangeLog     Sat May 17 00:13:43 2014
@@ -6,6 +6,9 @@
        * EcLogger.m: Use floating point flush interval for modern
        systems which run faster and might want to flush more than
        once per second.
+       * EcProcess.m: Don't start handling timeouts until the
+       process is actually running (so we don't get any during
+       initialisation of the class).
        * GNUmakefile: bump subminor version number for release
        Version 1.1.3 release
 

Modified: libs/ec/trunk/EcProcess.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/ec/trunk/EcProcess.m?rev=37889&r1=37888&r2=37889&view=diff
==============================================================================
--- libs/ec/trunk/EcProcess.m   (original)
+++ libs/ec/trunk/EcProcess.m   Sat May 17 00:13:43 2014
@@ -105,6 +105,7 @@
 static BOOL            cmdFlagDaemon = NO;
 static BOOL            cmdFlagTesting = NO;
 static BOOL            cmdIsQuitting = NO;
+static BOOL            cmdIsRunning = NO;
 static NSInteger        cmdQuitStatus = 0;
 static NSString                *cmdInst = nil;
 static NSString                *cmdName = nil;
@@ -2299,7 +2300,7 @@
   arp = [NSAutoreleasePool new];
   if (YES == cmdIsTransient)
     {
-      [self cmdWarn: @"Attempted to run transient  process."];
+      [self cmdWarn: @"Attempted to run transient process."];
       [self cmdFlushLogs];
       [arp release];
       return 1;
@@ -2347,6 +2348,7 @@
 
   [self cmdAudit: @"Started `%@'", [self cmdName]];
   [self cmdFlushLogs];
+  cmdIsRunning = YES;
   
   loop = [NSRunLoop currentRunLoop];
   while (YES == [EcProcConnection isValid])
@@ -2379,9 +2381,9 @@
   [arp release];
 
   /* finish server */
-
   cmdIsQuitting = YES;
   [self cmdQuit: 0];
+  cmdIsRunning = NO;
   DESTROY(EcProcConnection);
   return 0;
 }
@@ -4119,7 +4121,11 @@
       cmdIsQuitting = YES;
       [self cmdQuit: sig];
     }
-  if (YES == inProgress)
+  if (YES == cmdIsQuitting)
+    {
+      NSLog(@"_timedOut: ignored because process is quitting");
+    }
+  else if (YES == inProgress)
     {
       NSLog(@"_timedOut: ignored because timeout already in progress");
     }
@@ -4128,76 +4134,85 @@
       BOOL     delay = NO;
 
       inProgress = YES;
-      NS_DURING
-       {
-         NSCalendarDate        *now = [NSCalendarDate date];
-         static int            lastDay = 0;
-         static int            lastHour = 0;
-         static int            lastMinute = 0;
-         static int            lastTenSecond = 0;
-         BOOL                  newDay = NO;
-         BOOL                  newHour = NO;
-         BOOL                  newMinute = NO;
-         BOOL                  newTenSecond = NO;
-         int                   i;
-
-         i = [now dayOfWeek];
-         if (i != lastDay)
-           {
-             lastDay = i;
-             newDay = YES;
-             newHour = YES;
-             newMinute = YES;
-             newTenSecond = YES;
-           }
-         i = [now hourOfDay];
-         if (i != lastHour)
-           {
-             lastHour = i;
-             newHour = YES;
-             newMinute = YES;
-             newTenSecond = YES;
-           }
-         i = [now minuteOfHour];
-         if (i != lastMinute)
-           {
-             lastMinute = i;
-             newMinute = YES;
-             newTenSecond = YES;
-           }
-         i = [now secondOfMinute] / 10;
-         if (i != lastTenSecond)
-           {
-             lastTenSecond = i;
-             newTenSecond = YES;
-           }
-         if (YES == newTenSecond)
-           {
-             [self cmdNewServer];
-           }
-         if (YES == newMinute)
-           {
-             [self ecNewMinute: now];
-           }
-         if (YES == newHour)
-           {
-             [self ecNewHour: now];
-           }
-         if (YES == newDay)
-           {
-             [self ecNewDay: now];
-           }
-         if (cmdTimSelector != 0)
-           {
-             [self performSelector: cmdTimSelector];
-           }
-       }
-      NS_HANDLER
-       {
-         NSLog(@"Exception performing regular timeout: %@", localException);
-         delay = YES;  // Avoid runaway logging.
-       }
-      NS_ENDHANDLER
+
+      /* We only perform timeouts if the process is actually
+       * running (don't want them during startup before the
+       * thing is fully initialised.
+       * So if not running, skip to scheduling next timeout.
+       */
+      if (YES == cmdIsRunning)
+        {
+          NS_DURING
+            {
+              NSCalendarDate   *now = [NSCalendarDate date];
+              static int       lastDay = 0;
+              static int       lastHour = 0;
+              static int       lastMinute = 0;
+              static int       lastTenSecond = 0;
+              BOOL             newDay = NO;
+              BOOL             newHour = NO;
+              BOOL             newMinute = NO;
+              BOOL             newTenSecond = NO;
+              int              i;
+
+              i = [now dayOfWeek];
+              if (i != lastDay)
+                {
+                  lastDay = i;
+                  newDay = YES;
+                  newHour = YES;
+                  newMinute = YES;
+                  newTenSecond = YES;
+                }
+              i = [now hourOfDay];
+              if (i != lastHour)
+                {
+                  lastHour = i;
+                  newHour = YES;
+                  newMinute = YES;
+                  newTenSecond = YES;
+                }
+              i = [now minuteOfHour];
+              if (i != lastMinute)
+                {
+                  lastMinute = i;
+                  newMinute = YES;
+                  newTenSecond = YES;
+                }
+              i = [now secondOfMinute] / 10;
+              if (i != lastTenSecond)
+                {
+                  lastTenSecond = i;
+                  newTenSecond = YES;
+                }
+              if (YES == newTenSecond)
+                {
+                  [self cmdNewServer];
+                }
+              if (YES == newMinute)
+                {
+                  [self ecNewMinute: now];
+                }
+              if (YES == newHour)
+                {
+                  [self ecNewHour: now];
+                }
+              if (YES == newDay)
+                {
+                  [self ecNewDay: now];
+                }
+              if (cmdTimSelector != 0)
+                {
+                  [self performSelector: cmdTimSelector];
+                }
+            }
+          NS_HANDLER
+            {
+              NSLog(@"Exception performing regular timeout: %@", 
localException);
+              delay = YES;     // Avoid runaway logging.
+            }
+          NS_ENDHANDLER
+        }
 
       if (cmdPTimer == nil)
        {


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to