]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - SHUTTLE/AliShuttleTrigger.cxx
Allow fixing of local parameters for solver
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.cxx
index d7ab8fe426b92a4dc39ae801fc3d5ff2194e76a5..1f10af561c889123547f0b3f5d6d6576f9b85c1a 100644 (file)
@@ -206,6 +206,24 @@ void AliShuttleTrigger::Terminate() {
        fCondition.Signal();
 }
 
+//______________________________________________________________________________________________
+void AliShuttleTrigger::CheckTerminate() 
+{
+       // 
+       // Checks if the Shuttle got an external terminate request by a created file 
+       // This is an alternative to the signal which causes problems with the API libraries
+       //
+
+       if (strlen(fConfig->GetTerminateFilePath()) == 0)
+               return;
+
+       if (gSystem->AccessPathName(fConfig->GetTerminateFilePath()) == kFALSE)
+       {
+               AliInfo("Terminate file exists. Terminating Shuttle...");
+               fTerminate = kTRUE;
+       }
+}
+
 //______________________________________________________________________________________________
 void AliShuttleTrigger::Run() {
        //
@@ -230,6 +248,7 @@ void AliShuttleTrigger::Run() {
 
                while (!(fNotified || fTerminate)) {
                        received=fCondition.TimedWaitRelative(1000*fConfig->GetTriggerWait());
+                       CheckTerminate();
                        if (received==1) break; // 1 = timeout
                }
 
@@ -268,6 +287,7 @@ void AliShuttleTrigger::Run() {
                }
        
                Collect();
+               CheckTerminate();
        }
 
        delete notifier;