#include <TGo4Thread.h>
Public Methods | |
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. More... | |
virtual | ~TGo4Thread () |
TGo4Thread & | operator= (const TGo4Thread &right) |
Bool_t | Create () |
creates the TThread if not yet existing. More... | |
Bool_t | Cancel () |
Cancels TThread. More... | |
Bool_t | ReCreate () |
Stops old Runnable; Creates new TThread of same Runnable and name; cancels old Thread. More... | |
Bool_t | Start () |
starts runnable method Run within thread loop by setting running flag and signaling condition. More... | |
Bool_t | Stop () |
resets running flag for runnable. More... | |
Int_t | GetPID () const |
linux process id associated with the pthread. More... | |
Int_t | GetSelfID () const |
self id of the current thread. More... | |
Bool_t | IsInternal () const |
returns flag indicating if go4thread object is internal to threadhandler or created externally. More... | |
Bool_t | IsCreated () const |
kTRUE if TThread instance exists and pthread is created. More... | |
Bool_t | IsRunning () const |
Flag that controls Workfunc loop within Threadfunc. More... | |
Bool_t | IsWaiting () |
true if Threadfunc is suspended to condition wait. More... | |
Static Public Methods | |
void | Sleep (UInt_t millisecs) |
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termination. More... | |
Private Methods | |
TGo4Runnable * | GetRunnable () |
We need this to have access to instance runnable from static Threadfunc:. More... | |
TCondition * | GetCondition () |
void | SetPID () |
void | SetSelfID () |
void | SetWaiting (Bool_t mode=kTRUE) |
TGo4Thread () | |
Static Private Methods | |
void | Threadfunc (void *arg) |
This function is passed to TThread ctor and runs as pthread. More... | |
Private Attributes | |
Bool_t | fbIsInternal |
specifes whether thread is internal thread of handlerr (true) or is owned by external class (false). More... | |
Bool_t | fbIsCreated |
kTRUE if TThread instance exists and pthread is created. More... | |
Bool_t | fbIsRunning |
Flag that controls Workfunc loop within Threadfunc. More... | |
Int_t | fiThreadPID |
linux process id associated with the pthread. More... | |
Int_t | fiThreadSelfID |
self id of the current thread. More... | |
Bool_t | fbIsWaiting |
true if Threadfunc is suspended to condition wait. More... | |
TGo4Runnable * | fxRunnable |
External class providing the threaded workfunction and exception routines for workfunction. More... | |
TThread * | fxThread |
TCondition * | fxCondition |
This working loop can be suspended to a condition wait to stop the action.
Definition at line 36 of file TGo4Thread.h.
|
Definition at line 25 of file TGo4Thread.cxx. References fbIsInternal, fxCondition, fxRunnable, and TRACE. |
|
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 34 of file TGo4Thread.cxx. References TGo4Log::Debug(), fbIsInternal, fxCondition, fxRunnable, TGo4Runnable::SetThread(), and TRACE. |
|
Definition at line 53 of file TGo4Thread.cxx. References Cancel(), TGo4Log::Debug(), fxCondition, fxRunnable, Stop(), and TRACE. |
|
|
|
Definition at line 76 of file TGo4Thread.cxx. References fxCondition, fxRunnable, and TRACE. |
|
creates the TThread if not yet existing.
Definition at line 185 of file TGo4Thread.cxx. References fbIsCreated, fxThread, Threadfunc(), and TRACE. Referenced by TGo4ThreadHandler::Create(), TGo4ThreadHandler::CreateAll(), TGo4CreateException::Handle(), ReCreate(), and Start(). |
|
Cancels TThread.
Definition at line 206 of file TGo4Thread.cxx. References TGo4Log::Debug(), fbIsCreated, fbIsRunning, fiThreadPID, fiThreadSelfID, fxCondition, fxThread, Sleep(), and TRACE. Referenced by TGo4ThreadHandler::Cancel(), TGo4ThreadHandler::CancelAll(), TGo4CancelException::Handle(), TGo4TestRunnable::Run(), and ~TGo4Thread(). |
|
Stops old Runnable; Creates new TThread of same Runnable and name; cancels old Thread.
Definition at line 246 of file TGo4Thread.cxx. References Create(), TGo4Log::Debug(), fbIsCreated, fiThreadPID, fiThreadSelfID, fxCondition, fxThread, Start(), Stop(), Threadfunc(), and TRACE. Referenced by TGo4RestartException::Handle(), TGo4ThreadHandler::ReCreate(), and TGo4ThreadHandler::ReCreateAll(). |
|
starts runnable method Run within thread loop by setting running flag and signaling condition.
Definition at line 302 of file TGo4Thread.cxx. References Create(), fbIsCreated, fbIsRunning, fxCondition, and TRACE. Referenced by TGo4StartException::Handle(), ReCreate(), TGo4ThreadHandler::Start(), and TGo4ThreadHandler::StartAll(). |
|
resets running flag for runnable.
Definition at line 323 of file TGo4Thread.cxx. References fbIsRunning, and TRACE. Referenced by TGo4TaskHandlerRunnable::CheckStopBuffer(), TGo4TaskHandlerAbortException::Handle(), ReCreate(), TGo4StatusRunnable::Run(), TGo4LocalCommandRunnable::Run(), TGo4DataRunnable::Run(), TGo4ConnectorRunnable::Run(), TGo4CommandRunnable::Run(), TGo4ObjConnectorRunnable::Run(), TGo4AnalysisMainRunnable::Run(), TGo4ThreadHandler::Stop(), TGo4ThreadHandler::StopAll(), and ~TGo4Thread(). |
|
wrapper for gSystem->Sleep with consecutive TThread::CancelPoint - necessary for proper pthread termination.
Definition at line 331 of file TGo4Thread.cxx. References TRACE. Referenced by Cancel(), TGo4TaskHandlerRunnable::CheckTransportOpen(), TGo4HistogramServer::ConnectObjectClient(), TGo4ComInitAnalysis::ExeCom(), TGo4ServerTask::LaunchClient(), TGo4Analysis::Process(), TGo4TestRunnable::Run(), TGo4WatchRunnable::Run(), TGo4MainRunnable::Run(), TGo4LoggingRunnable::Run(), TGo4ControllerRunnable::Run(), TGo4AnalysisWatchRunnable::Run(), TGo4AnalysisMainRunnable::Run(), TGo4TaskManager::ServeClient(), TGo4ServerTask::Shutdown(), Threadfunc(), TGo4TaskManager::WaitForClientRemoved(), TGo4ServerTask::WaitForClose(), TGo4HistogramServer::WaitForClose(), TGo4ServerTask::WaitForConnection(), TGo4HistogramServer::WaitForConnection(), TGo4ServerTask::WaitForOpen(), TGo4HistogramServer::WaitForOpen(), TGo4TaskHandler::WaitGetPort(), and TGo4TaskHandler::WaitThreadStop(). |
|
linux process id associated with the pthread.
Definition at line 93 of file TGo4Thread.h. References fiThreadPID. Referenced by TGo4ThreadHandler::AllCreated(), TGo4ThreadHandler::DumpThreads(), TGo4Runnable::ThreadCatch(), Threadfunc(), and TGo4Runnable::UnexpectedCatch(). |
|
self id of the current thread.
Definition at line 101 of file TGo4Thread.h. References fiThreadSelfID. Referenced by TGo4ThreadHandler::DumpThreads(), and Threadfunc(). |
|
returns flag indicating if go4thread object is internal to threadhandler or created externally.
Definition at line 110 of file TGo4Thread.h. References fbIsInternal. Referenced by TGo4ThreadHandler::RemoveThread(), and TGo4ThreadHandler::~TGo4ThreadHandler(). |
|
kTRUE if TThread instance exists and pthread is created.
Definition at line 119 of file TGo4Thread.h. References fbIsCreated. Referenced by Threadfunc(). |
|
Flag that controls Workfunc loop within Threadfunc.
Definition at line 127 of file TGo4Thread.h. References fbIsRunning. Referenced by TGo4ThreadHandler::AllRunning(), TGo4CommandRunnable::Run(), and Threadfunc(). |
|
true if Threadfunc is suspended to condition wait.
Definition at line 135 of file TGo4Thread.h. References fbIsWaiting. Referenced by TGo4ThreadHandler::AllWaiting(), TGo4ServerTask::ConnectorThreadIsStopped(), and TGo4TaskHandler::WaitThreadStop(). |
|
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 96 of file TGo4Thread.cxx. References TGo4Log::Debug(), GetCondition(), GetPID(), GetRunnable(), GetSelfID(), IsCreated(), IsRunning(), TGo4Runnable::PostRun(), TGo4Runnable::PreRun(), TGo4Runnable::Run(), SetPID(), SetSelfID(), SetWaiting(), Sleep(), TGo4Runnable::ThreadCatch(), and TRACE. |
|
We need this to have access to instance runnable from static Threadfunc:.
Definition at line 156 of file TGo4Thread.h. References fxRunnable. Referenced by Threadfunc(). |
|
Definition at line 161 of file TGo4Thread.h. References fxCondition. Referenced by Threadfunc(). |
|
Definition at line 166 of file TGo4Thread.h. References fiThreadPID. Referenced by Threadfunc(). |
|
Definition at line 171 of file TGo4Thread.h. References fiThreadSelfID. Referenced by Threadfunc(). |
|
Definition at line 176 of file TGo4Thread.h. References fbIsWaiting. Referenced by Threadfunc(). |
|
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 188 of file TGo4Thread.h. Referenced by IsInternal(), and TGo4Thread(). |
|
kTRUE if TThread instance exists and pthread is created.
Definition at line 194 of file TGo4Thread.h. Referenced by Cancel(), Create(), IsCreated(), ReCreate(), and Start(). |
|
Flag that controls Workfunc loop within Threadfunc.
Definition at line 199 of file TGo4Thread.h. |
|
linux process id associated with the pthread.
Definition at line 204 of file TGo4Thread.h. |
|
self id of the current thread.
Definition at line 209 of file TGo4Thread.h. Referenced by Cancel(), GetSelfID(), ReCreate(), and SetSelfID(). |
|
true if Threadfunc is suspended to condition wait.
Definition at line 214 of file TGo4Thread.h. Referenced by IsWaiting(), and SetWaiting(). |
|
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. @clientCardinality 1 @supplierCardinality 1 Definition at line 225 of file TGo4Thread.h. Referenced by GetRunnable(), operator=(), TGo4Thread(), and ~TGo4Thread(). |
|
Definition at line 227 of file TGo4Thread.h. |
|
Definition at line 229 of file TGo4Thread.h. Referenced by Cancel(), GetCondition(), operator=(), ReCreate(), Start(), TGo4Thread(), and ~TGo4Thread(). |