#include <TGo4Thread.h>
Public Member Functions | |
TGo4Thread (const TGo4Thread &right) | |
TGo4Thread (const char *name, TGo4Runnable *runnable, Bool_t internal=kTRUE) | |
TGo4Thread constructor parameters: name: name of the thread runnable: external user runnable to be executed from TThread. | |
virtual | ~TGo4Thread () |
Bool_t | Create () |
creates the TThread if not yet existing | |
Bool_t | Cancel () |
Cancels TThread. | |
Bool_t | ReCreate () |
Stops old Runnable; Creates new TThread of same Runnable and name; cancels old Thread. | |
Bool_t | Start () |
starts runnable method Run within thread loop by setting running flag and signaling condition | |
Bool_t | Stop () |
resets running flag for runnable | |
Int_t | GetPID () const |
linux process id associated with the pthread | |
Long_t | GetSelfID () const |
self id of the current thread | |
Bool_t | IsInternal () const |
returns flag indicating if go4thread object is internal to threadhandler or created externally | |
Bool_t | IsCreated () const |
kTRUE if TThread instance exists and pthread is created | |
Bool_t | IsRunning () const |
Flag that controls Workfunc loop within Threadfunc. | |
Bool_t | IsWaiting () const |
true if Threadfunc is suspended to condition wait | |
Static Public Member Functions | |
static void | Sleep (UInt_t millisecs) |
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termination | |
Private Member Functions | |
TGo4Runnable * | GetRunnable () const |
We need this to have access to instance runnable from static Threadfunc:. | |
TCondition * | GetCondition () const |
void | SetPID () |
void | SetSelfID () |
void | SetWaiting (Bool_t mode=kTRUE) |
TGo4Thread () | |
Static Private Member Functions | |
static void | Threadfunc (void *arg) |
This function is passed to TThread ctor and runs as pthread. | |
Private Attributes | |
Bool_t | fbIsInternal |
specifes whether thread is internal thread of handlerr (true) or is owned by external class (false). | |
Bool_t | fbIsCreated |
kTRUE if TThread instance exists and pthread is created | |
Bool_t | fbIsRunning |
Flag that controls Workfunc loop within Threadfunc. | |
Int_t | fiThreadPID |
Linux process id associated with the pthread. | |
Long_t | fiThreadSelfID |
self id of the current thread | |
Bool_t | fbIsWaiting |
true if Threadfunc is suspended to condition wait | |
TGo4Runnable * | fxRunnable |
External class providing the threaded workfunction and exception routines for workfunction. | |
TThread * | fxThread |
TCondition * | fxCondition |
This working loop can be suspended to a condition wait to stop the action.
Definition at line 33 of file TGo4Thread.h.
TGo4Thread::TGo4Thread | ( | const TGo4Thread & | right | ) |
Definition at line 27 of file TGo4Thread.cxx.
TGo4Thread::TGo4Thread | ( | const char * | name, | |
TGo4Runnable * | runnable, | |||
Bool_t | internal = kTRUE | |||
) |
TGo4Thread constructor parameters: name: name of the thread runnable: external user runnable to be executed from TThread.
internal: define if thread shall be owned by threadmanager, or if it belongs to other aggregation
Definition at line 36 of file TGo4Thread.cxx.
TGo4Thread::~TGo4Thread | ( | ) | [virtual] |
Definition at line 55 of file TGo4Thread.cxx.
TGo4Thread::TGo4Thread | ( | ) | [private] |
Bool_t TGo4Thread::Create | ( | ) |
Bool_t TGo4Thread::Cancel | ( | ) |
Bool_t TGo4Thread::ReCreate | ( | ) |
Stops old Runnable; Creates new TThread of same Runnable and name; cancels old Thread.
Definition at line 246 of file TGo4Thread.cxx.
Bool_t TGo4Thread::Start | ( | ) |
starts runnable method Run within thread loop by setting running flag and signaling condition
Definition at line 302 of file TGo4Thread.cxx.
Bool_t TGo4Thread::Stop | ( | ) |
void TGo4Thread::Sleep | ( | UInt_t | millisecs | ) | [static] |
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termination
Definition at line 331 of file TGo4Thread.cxx.
Int_t TGo4Thread::GetPID | ( | ) | const [inline] |
Long_t TGo4Thread::GetSelfID | ( | ) | const [inline] |
Bool_t TGo4Thread::IsInternal | ( | ) | const [inline] |
returns flag indicating if go4thread object is internal to threadhandler or created externally
Definition at line 78 of file TGo4Thread.h.
Bool_t TGo4Thread::IsCreated | ( | ) | const [inline] |
Bool_t TGo4Thread::IsRunning | ( | ) | const [inline] |
Bool_t TGo4Thread::IsWaiting | ( | ) | const [inline] |
void TGo4Thread::Threadfunc | ( | void * | arg | ) | [static, private] |
This function is passed to TThread ctor and runs as pthread.
Contains a loop that is controlled by Go4Thread own TCondition and by "function shall run" flag. Within the loop the virtual working function is called.
Definition at line 77 of file TGo4Thread.cxx.
TGo4Runnable* TGo4Thread::GetRunnable | ( | ) | const [inline, private] |
We need this to have access to instance runnable from static Threadfunc:.
Definition at line 98 of file TGo4Thread.h.
TCondition* TGo4Thread::GetCondition | ( | ) | const [inline, private] |
Definition at line 100 of file TGo4Thread.h.
void TGo4Thread::SetPID | ( | ) | [private] |
Definition at line 343 of file TGo4Thread.cxx.
void TGo4Thread::SetSelfID | ( | ) | [private] |
Definition at line 338 of file TGo4Thread.cxx.
void TGo4Thread::SetWaiting | ( | Bool_t | mode = kTRUE |
) | [inline, private] |
Definition at line 106 of file TGo4Thread.h.
Bool_t TGo4Thread::fbIsInternal [private] |
specifes whether thread is internal thread of handlerr (true) or is owned by external class (false).
In the latter case, thread instance and its runnable are not deleted when it is removed from the thread list
Definition at line 113 of file TGo4Thread.h.
Bool_t TGo4Thread::fbIsCreated [private] |
kTRUE if TThread instance exists and pthread is created
Definition at line 116 of file TGo4Thread.h.
Bool_t TGo4Thread::fbIsRunning [private] |
Int_t TGo4Thread::fiThreadPID [private] |
Long_t TGo4Thread::fiThreadSelfID [private] |
Bool_t TGo4Thread::fbIsWaiting [private] |
TGo4Runnable* TGo4Thread::fxRunnable [private] |
External class providing the threaded workfunction and exception routines for workfunction.
The threaded action will be defined by creating a runnable subclass and overriding the TGo4Runnable::Run() method. Here exception handling behaviour may be overridden, too. 1 1
Definition at line 137 of file TGo4Thread.h.
TThread* TGo4Thread::fxThread [private] |
Definition at line 139 of file TGo4Thread.h.
TCondition* TGo4Thread::fxCondition [private] |
Definition at line 141 of file TGo4Thread.h.