GSI Object Oriented Online Offline (Go4) GO4-6.4.0
|
Go4 thread manager. More...
#include <TGo4ThreadManager.h>
Public Types | |
enum | { fguTEXTLENGTH = 256 } |
Default textlength for char arrays. More... | |
Public Member Functions | |
TGo4ThreadManager (const char *name, Bool_t blockingmode=kTRUE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE) | |
Normal constructor. | |
TGo4ThreadManager (const TGo4ThreadManager &right) | |
virtual | ~TGo4ThreadManager () |
Bool_t | BlockApp () |
Blocks gSystem by means of the blocking timer. | |
TGo4ThreadHandler * | GetWorkHandler () const |
Access to ThreadHandler for working threads. | |
virtual Int_t | Initialization () |
Bool_t | IsAppBlocking () const |
Returns true if threadmanager works in root system blocking mode. | |
Bool_t | IsBeingQuit () const |
Returns true if threadmanager works in root system blocking mode. | |
Bool_t | IsInitDone () const |
Bool_t | IsTerminateApp () const |
Bool_t | IsTerminating () const |
returns termination status of Threadmanager | |
void | Launch () |
This Method has to be called to create the startup threads and to turn on the application control timer. | |
void | SetBeingQuit (Bool_t on) |
void | SetTimer (TGo4AppControlTimer *ctrltimer) |
user can exchange the standard control timer by an own derived one by this method | |
virtual void | Terminate (Bool_t termap=kTRUE) |
deletes the Manager instance via Control timer. | |
virtual void | TerminateFast () |
Alternative termination in case of error. | |
Bool_t | UnBlockApp (Int_t mode=0) |
Wakes up the control timer waiting for his condition; parameter mode specifies whether timer will block again at next turn (mode = 0), timer will block when all threads are up (mode = 1), or timer will not block again unless the next Block call, i.e. | |
Static Public Attributes | |
static const Long_t | fglTIMERPERIOD = 200 |
Period in ms for the application control timer. | |
Protected Attributes | |
Bool_t | fbAppBlocking {kFALSE} |
true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall never be blocked (necessary for gui) | |
Bool_t | fbAutoCreate {kFALSE} |
If true, TThreads of all go4threads in list shall be created automatically on calling Launch(). | |
Bool_t | fbAutoStart {kFALSE} |
If true, workfunctions (runnable Run()) of all go4threads in list shall be started automatically on Initialization. | |
Int_t | fbBeingQuit {0} |
Bool_t | fbInitDone {kFALSE} |
is set kTRUE after first Initialize is done | |
Bool_t | fbTerminateApplication {kFALSE} |
If true, terminate complete application. | |
Bool_t | fbTerminating {kFALSE} |
flag showing termination status | |
TGo4AppControlTimer * | fxBlocker {nullptr} |
Composition of Application control timer. | |
TGo4ThreadHandler * | fxWorkHandler {nullptr} |
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1. | |
Private Member Functions | |
TGo4ThreadManager () | |
Go4 thread manager.
Base class for classes that shall be accessed from a thread /runnable instance
Definition at line 32 of file TGo4ThreadManager.h.
anonymous enum |
Default textlength for char arrays.
Enumerator | |
---|---|
fguTEXTLENGTH |
Definition at line 99 of file TGo4ThreadManager.h.
TGo4ThreadManager::TGo4ThreadManager | ( | const TGo4ThreadManager & | right | ) |
Definition at line 25 of file TGo4ThreadManager.cxx.
References TGo4ThreadManager(), fbInitDone, fbTerminateApplication, fbTerminating, fxBlocker, fxWorkHandler, and GO4TRACE.
Referenced by TGo4Task::TGo4Task(), TGo4TestThreadManager::TGo4TestThreadManager(), TGo4ThreadManager(), and TGo4ThreadManager().
TGo4ThreadManager::TGo4ThreadManager | ( | const char * | name, |
Bool_t | blockingmode = kTRUE, | ||
Bool_t | autostart = kTRUE, | ||
Bool_t | autocreate = kTRUE ) |
Normal constructor.
name | - name for the thread manager |
blockingmode | - if true, gApplication is blocked by timer |
autostart | - if true, all thread runnables start their work on Initialization() |
autocreate | - if true, all threads added to handler in threadmanager ctor are created on Launch() |
Definition at line 36 of file TGo4ThreadManager.cxx.
References TGo4Log::Debug(), fbAppBlocking, fbAutoCreate, fbAutoStart, fbBeingQuit, fbInitDone, fbTerminateApplication, fbTerminating, fglTIMERPERIOD, fxBlocker, fxWorkHandler, and GO4TRACE.
|
virtual |
Definition at line 72 of file TGo4ThreadManager.cxx.
References fxWorkHandler, and GO4TRACE.
|
private |
References TGo4ThreadManager().
Bool_t TGo4ThreadManager::BlockApp | ( | ) |
Blocks gSystem by means of the blocking timer.
Definition at line 80 of file TGo4ThreadManager.cxx.
References fbAppBlocking, fbTerminating, fxBlocker, fxWorkHandler, and GO4TRACE.
Referenced by Initialization().
|
inline |
Access to ThreadHandler for working threads.
Definition at line 51 of file TGo4ThreadManager.h.
References fxWorkHandler.
Referenced by TGo4Task::TGo4Task(), TGo4ThreadException::TGo4ThreadException(), TGo4Display::~TGo4Display(), TGo4ServerTask::~TGo4ServerTask(), TGo4ServerTask::ConnectorThreadIsStopped(), TGo4Slave::GetThreadHandler(), TGo4ServerTask::StartConnectorThread(), TGo4ExampleServer::StartWorkThreads(), TGo4ServerTask::StopConnectorThread(), and TGo4ExampleServer::StopWorkThreads().
|
virtual |
Reimplemented in TGo4ClientTask, and TGo4Task.
Definition at line 156 of file TGo4ThreadManager.cxx.
References BlockApp(), TGo4Log::Debug(), fbAutoCreate, fbAutoStart, fbInitDone, fxWorkHandler, and GO4TRACE.
Referenced by TGo4Task::Initialization().
|
inline |
Returns true if threadmanager works in root system blocking mode.
Definition at line 74 of file TGo4ThreadManager.h.
References fbAppBlocking.
|
inline |
Returns true if threadmanager works in root system blocking mode.
Definition at line 77 of file TGo4ThreadManager.h.
References fbBeingQuit.
|
inline |
Definition at line 66 of file TGo4ThreadManager.h.
References fbInitDone.
|
inline |
Definition at line 71 of file TGo4ThreadManager.h.
References fbTerminateApplication.
|
inline |
returns termination status of Threadmanager
Definition at line 69 of file TGo4ThreadManager.h.
References fbTerminating.
Referenced by TGo4HistogramServer::ConnectObjectClient(), TGo4HistogramServer::WaitForConnection(), TGo4ServerTask::WaitForConnection(), and TGo4HistogramServer::WaitForOpen().
void TGo4ThreadManager::Launch | ( | ) |
This Method has to be called to create the startup threads and to turn on the application control timer.
Usually this is done at the end of the user's threadmanager constructor. The idea is that no thread should be started unless the user initializations are done; therefore, its up to the user to define when to Launch.
Definition at line 211 of file TGo4ThreadManager.cxx.
References fbAutoCreate, fxBlocker, fxWorkHandler, and GO4TRACE.
Referenced by TGo4ClientTask::TGo4ClientTask(), TGo4Display::TGo4Display(), TGo4ExampleClient::TGo4ExampleClient(), TGo4ExampleServer::TGo4ExampleServer(), TGo4ServerTask::TGo4ServerTask(), TGo4TestThreadManager::TGo4TestThreadManager(), and TGo4AnalysisClient::Constructor().
|
inline |
Definition at line 79 of file TGo4ThreadManager.h.
References fbBeingQuit.
|
inline |
user can exchange the standard control timer by an own derived one by this method
Definition at line 48 of file TGo4ThreadManager.h.
References fxBlocker.
|
virtual |
deletes the Manager instance via Control timer.
termap | if true, also terminates the root Application |
Reimplemented in TGo4Task.
Definition at line 228 of file TGo4ThreadManager.cxx.
References TGo4Log::Debug(), fbTerminateApplication, fbTerminating, fxWorkHandler, GO4TRACE, and UnBlockApp().
Referenced by TGo4Task::Terminate(), and TerminateFast().
|
virtual |
Alternative termination in case of error.
Reimplemented in TGo4Task.
Definition at line 242 of file TGo4ThreadManager.cxx.
References Terminate().
Referenced by TGo4Task::TerminateFast().
Bool_t TGo4ThreadManager::UnBlockApp | ( | Int_t | mode = 0 | ) |
Wakes up the control timer waiting for his condition; parameter mode specifies whether timer will block again at next turn (mode = 0), timer will block when all threads are up (mode = 1), or timer will not block again unless the next Block call, i.e.
applicationrun flag is reset (mode=2)
Definition at line 108 of file TGo4ThreadManager.cxx.
References fxBlocker, and GO4TRACE.
Referenced by Terminate().
|
protected |
true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall never be blocked (necessary for gui)
Definition at line 116 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), BlockApp(), IsAppBlocking(), and TGo4Task::UpdateStatus().
|
protected |
If true, TThreads of all go4threads in list shall be created automatically on calling Launch().
Definition at line 120 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), Initialization(), Launch(), and TGo4Task::UpdateStatus().
|
protected |
If true, workfunctions (runnable Run()) of all go4threads in list shall be started automatically on Initialization.
If false, TThreads may be running, but workfunctions suspend in condition wait.
Definition at line 125 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), Initialization(), and TGo4Task::UpdateStatus().
|
protected |
Definition at line 130 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), IsBeingQuit(), and SetBeingQuit().
|
protected |
is set kTRUE after first Initialize is done
Definition at line 104 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), TGo4ThreadManager(), TGo4ClientTask::Initialization(), TGo4Task::Initialization(), Initialization(), IsInitDone(), and TGo4Task::UpdateStatus().
|
protected |
If true, terminate complete application.
If false, only terminate threadmanager instance.
Definition at line 111 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), TGo4ThreadManager(), IsTerminateApp(), and Terminate().
|
protected |
flag showing termination status
Definition at line 107 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), TGo4ThreadManager(), BlockApp(), IsTerminating(), Terminate(), and TGo4Task::UpdateStatus().
|
static |
Period in ms for the application control timer.
Definition at line 96 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager().
|
protected |
Composition of Application control timer.
aggregationByValue 1 1
Definition at line 136 of file TGo4ThreadManager.h.
Referenced by TGo4ThreadManager(), TGo4ThreadManager(), BlockApp(), Launch(), SetTimer(), and UnBlockApp().
|
protected |
Thread handler aggregate (threadsafe list of go4 threads) aggregationByValue 1 1.
Definition at line 142 of file TGo4ThreadManager.h.
Referenced by TGo4ExampleClient::TGo4ExampleClient(), TGo4ExampleServer::TGo4ExampleServer(), TGo4ServerTask::TGo4ServerTask(), TGo4TestThreadManager::TGo4TestThreadManager(), TGo4ThreadManager(), TGo4ThreadManager(), TGo4ExampleClient::~TGo4ExampleClient(), TGo4ExampleServer::~TGo4ExampleServer(), ~TGo4ThreadManager(), BlockApp(), TGo4ClientTask::ConnectServer(), GetWorkHandler(), TGo4Task::Initialization(), Initialization(), Launch(), TGo4ExampleClient::Start(), TGo4ExampleClient::Stop(), TGo4Task::SubmitLocalCommand(), and Terminate().