Changeset 11061


Ignore:
Timestamp:
06/18/11 17:48:17 (13 years ago)
Author:
tbretz
Message:
Improved the output when a command was added; suppress anything inside Run() if fExitStatus was set already before Run() was called
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/StateMachineImp.cc

    r10977 r11061  
    548548
    549549    Out() << ":   " << Time().GetAsStr() << " - Adding command " << evt->GetName();
    550     Out() << " (transition to " << GetStateDescription(evt->GetTargetState()) << ")" << endl;
     550    if (evt->GetTargetState()>=0)
     551        Out() << " (transition to " << GetStateDescription(evt->GetTargetState()) << ")";
     552    Out() << endl;
     553
    551554
    552555    fListOfEvents.push_back(evt);
     
    10451048    }
    10461049
    1047     fRunning = !dummy;
    1048 
    1049     SetCurrentState(kSM_Ready, "by Run()");
    1050 
    1051     while (!fExitRequested)
    1052     {
    1053         usleep(1);
    1054         if (dummy)
    1055             continue;
    1056 
    1057         // Execute a step in the current state of the state machine
    1058         if (!HandleNewState(Execute(), "by Execute-command"))
    1059             break;
    1060 
    1061         // If the command stack is empty go on with processing in the
    1062         // current state
    1063         if (IsQueueEmpty())
    1064             continue;
    1065 
    1066         // Pop the next command which arrived from the stack
    1067         const auto_ptr<Event> cmd(PopEvent());
    1068 
    1069         if (!HandleEvent(*cmd))
    1070             break;
    1071     }
    1072 
    1073     fRunning = false;
    1074 
    10751050    if (!fExitRequested)
    10761051    {
    1077         Fatal("Fatal Error occured... shutting down.");
    1078         return -1;
    1079     }
    1080 
    1081     SetCurrentState(kSM_NotReady, "due to return from Run().");
     1052        fRunning = !dummy;
     1053
     1054        SetCurrentState(kSM_Ready, "by Run()");
     1055
     1056        while (!fExitRequested)
     1057        {
     1058            usleep(1);
     1059            if (dummy)
     1060                continue;
     1061
     1062            // Execute a step in the current state of the state machine
     1063            if (!HandleNewState(Execute(), "by Execute-command"))
     1064                break;
     1065
     1066            // If the command stack is empty go on with processing in the
     1067            // current state
     1068            if (IsQueueEmpty())
     1069                continue;
     1070
     1071            // Pop the next command which arrived from the stack
     1072            const auto_ptr<Event> cmd(PopEvent());
     1073
     1074            if (!HandleEvent(*cmd))
     1075                break;
     1076        }
     1077
     1078        fRunning = false;
     1079
     1080        if (!fExitRequested)
     1081        {
     1082            Fatal("Fatal Error occured... shutting down.");
     1083            return -1;
     1084        }
     1085
     1086        SetCurrentState(kSM_NotReady, "due to return from Run().");
     1087    }
    10821088
    10831089    const int exitcode = fExitRequested-1;
Note: See TracChangeset for help on using the changeset viewer.