Changeset 13951


Ignore:
Timestamp:
05/28/12 10:46:55 (13 years ago)
Author:
tbretz
Message:
Enable to buffer all events per default until the main event loop has been started.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r13909 r13951  
    122122StateMachineImp::StateMachineImp(ostream &out, const std::string &name)
    123123    : MessageImp(out), fName(name), fCurrentState(kSM_NotReady),
    124     fRunning(false), fExitRequested(0)
     124    fRunning(false), fBufferEvents(true), fExitRequested(0)
    125125{
    126126    SetDefaultStateNames();
     
    319319    }
    320320
    321     if (IsRunning())
     321    if (IsRunning() || fBufferEvents)
    322322    {
    323323        Event *event = new Event(evt, ptr, siz);
     
    367367    }
    368368
    369     if (IsRunning())
     369    if (IsRunning() || fBufferEvents)
    370370        PushEvent(new Event(evt));
    371371    else
  • trunk/FACT++/src/StateMachineImp.h

    r13834 r13951  
    4444
    4545    bool fRunning;       /// Machine is in main-loop
     46    bool fBufferEvents;  /// Flag if events should be buffered outside the event loop
    4647    int  fExitRequested; /// This is a flag which is set true if the main loop should stop
    4748
     
    116117    /// Used to check if the main loop is already running or still running
    117118    bool IsRunning() const { return fRunning; }
     119
     120    /// Used to enable or disable buffering of events outside of the main loop
     121    void EnableBuffer(bool b=true) { fBufferEvents=b; }
    118122
    119123    /// Post an event to the event queue
Note: See TracChangeset for help on using the changeset viewer.