GSI Object Oriented Online Offline (Go4) GO4-6.4.0
|
Timer with main purpose to block the root TApplication loop during thread execution. More...
#include <TGo4AppControlTimer.h>
Public Member Functions | |
TGo4AppControlTimer ()=delete | |
TGo4AppControlTimer (TGo4ThreadManager *manager, Long_t msperiod=3000, Bool_t mode=kTRUE) | |
virtual | ~TGo4AppControlTimer () |
Bool_t | GetApplicationRun () const |
Status of the application run flag. | |
const TCondition * | GetCondition () const |
Returns handle for internal condition which is used to block the gSystem. | |
Bool_t | Notify () override |
Routine called from TTimer on timeout. | |
void | SetApplicationRun (Bool_t flag=kTRUE) |
Switches between blocking and non blocking mode of the timer. | |
void | SetManager (TGo4ThreadManager *parent) |
Sets reference to new thread manager. | |
Protected Attributes | |
TGo4ThreadManager * | fxManager {nullptr} |
Backlink to threadmanager who owns this timer. | |
Static Protected Attributes | |
static Int_t | fgiTERMWAITCYCLES = 5 |
On Termination, Notify will test fgiTERMWAITCYCLES times if Runnables are stopped, i.e. | |
static UInt_t | fguTERMWAIT = 3000 |
time in ms to wait for all Runnables being stopped before Termination; after this time, the AllWaiting() of TGo4ThreadHandler is tested again, until the max number of testing cycles (fgiTERMWAITCYCLES) is reached; then Termination is done anyway | |
Private Attributes | |
Bool_t | fbApplicationRun {kFALSE} |
TCondition * | fxCondition {nullptr} |
Timer with main purpose to block the root TApplication loop during thread execution.
This timer calls Initialization() function of threadmanager, which can be overridden by user to define any actions which should not be run within a thread (critical root system calls, like opening TServerSocket, should be done within the application loop, i.e. in the timer). In threadmanager non-blocking-mode, Initialization() is called from timer regularly with the period specified in threadmanager; in blocking mode it is called once after each threadmanager UnBlockApp(). This timer is also responsible for proper termination of the threadmanager.
Definition at line 40 of file TGo4AppControlTimer.h.
|
delete |
TGo4AppControlTimer::TGo4AppControlTimer | ( | TGo4ThreadManager * | manager, |
Long_t | msperiod = 3000, | ||
Bool_t | mode = kTRUE ) |
Definition at line 29 of file TGo4AppControlTimer.cxx.
References fbApplicationRun, fxCondition, fxManager, and GO4TRACE.
|
virtual |
Definition at line 39 of file TGo4AppControlTimer.cxx.
References fxCondition, and GO4TRACE.
|
inline |
Status of the application run flag.
If true, root application is not blocked.
Definition at line 73 of file TGo4AppControlTimer.h.
References fbApplicationRun.
|
inline |
Returns handle for internal condition which is used to block the gSystem.
Definition at line 60 of file TGo4AppControlTimer.h.
References fxCondition.
|
override |
Routine called from TTimer on timeout.
Definition at line 48 of file TGo4AppControlTimer.cxx.
References TGo4Log::Debug(), TGo4Log::Error(), fbApplicationRun, fgiTERMWAITCYCLES, fguTERMWAIT, fxCondition, fxManager, and GO4TRACE.
|
inline |
Switches between blocking and non blocking mode of the timer.
If set to kTRUE, timer will not block the root system. If set to kFALSE, timer will suspend in a condition wait and therefore the InnerLoop() of root is blocked.
Definition at line 68 of file TGo4AppControlTimer.h.
References fbApplicationRun.
|
inline |
Sets reference to new thread manager.
Definition at line 51 of file TGo4AppControlTimer.h.
References fxManager.
|
private |
Definition at line 102 of file TGo4AppControlTimer.h.
Referenced by TGo4AppControlTimer(), GetApplicationRun(), Notify(), and SetApplicationRun().
|
staticprotected |
On Termination, Notify will test fgiTERMWAITCYCLES times if Runnables are stopped, i.e.
all TGo4Threads are in TCondition wait (safe cancelling point); afterwards, threads are deleted anyway
Definition at line 91 of file TGo4AppControlTimer.h.
Referenced by Notify().
|
staticprotected |
time in ms to wait for all Runnables being stopped before Termination; after this time, the AllWaiting() of TGo4ThreadHandler is tested again, until the max number of testing cycles (fgiTERMWAITCYCLES) is reached; then Termination is done anyway
Definition at line 83 of file TGo4AppControlTimer.h.
Referenced by Notify().
|
private |
Definition at line 104 of file TGo4AppControlTimer.h.
Referenced by TGo4AppControlTimer(), ~TGo4AppControlTimer(), GetCondition(), and Notify().
|
protected |
Backlink to threadmanager who owns this timer.
1 1
Definition at line 98 of file TGo4AppControlTimer.h.
Referenced by TGo4AppControlTimer(), Notify(), and SetManager().