GSI Object Oriented Online Offline (Go4)  GO4-6.3.0
Public Types | Public Member Functions | Static Public Attributes | Protected Attributes | Private Member Functions | List of all members
TGo4ThreadManager Class Reference

#include <TGo4ThreadManager.h>

+ Inheritance diagram for TGo4ThreadManager:

Public Types

enum  { fguTEXTLENGTH = 256 }
 

Public Member Functions

 TGo4ThreadManager (const TGo4ThreadManager &right)
 
 TGo4ThreadManager (const char *name, Bool_t blockingmode=kTRUE, Bool_t autostart=kTRUE, Bool_t autocreate=kTRUE)
 
virtual ~TGo4ThreadManager ()
 
void SetTimer (TGo4AppControlTimer *ctrltimer)
 
TGo4ThreadHandlerGetWorkHandler () const
 
Bool_t BlockApp ()
 
Bool_t UnBlockApp (Int_t mode=0)
 
virtual Int_t Initialization ()
 
Bool_t IsInitDone () const
 
Bool_t IsTerminating () const
 
Bool_t IsTerminateApp () const
 
Bool_t IsAppBlocking () const
 
Bool_t IsBeingQuit () const
 
void SetBeingQuit (Bool_t on)
 
void Launch ()
 
virtual void Terminate (Bool_t termapp=kTRUE)
 
virtual void TerminateFast ()
 

Static Public Attributes

static const Long_t fglTIMERPERIOD = 200
 

Protected Attributes

Bool_t fbInitDone {kFALSE}
 
Bool_t fbTerminating {kFALSE}
 
Bool_t fbTerminateApplication {kFALSE}
 
Bool_t fbAppBlocking {kFALSE}
 
Bool_t fbAutoCreate {kFALSE}
 
Bool_t fbAutoStart {kFALSE}
 
Int_t fbBeingQuit {0}
 
TGo4AppControlTimerfxBlocker {nullptr}
 
TGo4ThreadHandlerfxWorkHandler {nullptr}
 

Private Member Functions

 TGo4ThreadManager ()
 

Detailed Description

Base class for classes that shall be accessed from a thread /runnable instance

Author
J. Adamczewski(at)gsi.de
Go4 project-DVEE-GSI Darmstadt
Germany
Version
0.9
Since
jul 2000-oct 2001

Definition at line 30 of file TGo4ThreadManager.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Default textlength for char arrays

Enumerator
fguTEXTLENGTH 

Definition at line 97 of file TGo4ThreadManager.h.

Constructor & Destructor Documentation

◆ TGo4ThreadManager() [1/3]

TGo4ThreadManager::TGo4ThreadManager ( const TGo4ThreadManager right)

Definition at line 25 of file TGo4ThreadManager.cxx.

References fxBlocker, fxWorkHandler, and GO4TRACE.

◆ TGo4ThreadManager() [2/3]

TGo4ThreadManager::TGo4ThreadManager ( const char *  name,
Bool_t  blockingmode = kTRUE,
Bool_t  autostart = kTRUE,
Bool_t  autocreate = kTRUE 
)

ctor parameters: blockingmode=true: gApplication is blocked by timer autostart=true: all thread runnables start their work on Initialization() autocreate=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, fglTIMERPERIOD, fxBlocker, fxWorkHandler, and GO4TRACE.

◆ ~TGo4ThreadManager()

TGo4ThreadManager::~TGo4ThreadManager ( )
virtual

Definition at line 72 of file TGo4ThreadManager.cxx.

References fxWorkHandler, and GO4TRACE.

◆ TGo4ThreadManager() [3/3]

TGo4ThreadManager::TGo4ThreadManager ( )
private

Member Function Documentation

◆ BlockApp()

Bool_t TGo4ThreadManager::BlockApp ( )

◆ GetWorkHandler()

TGo4ThreadHandler* TGo4ThreadManager::GetWorkHandler ( ) const
inline

◆ Initialization()

Int_t TGo4ThreadManager::Initialization ( )
virtual

◆ IsAppBlocking()

Bool_t TGo4ThreadManager::IsAppBlocking ( ) const
inline

Returns true if threadmanager works in root system blocking mode

Definition at line 71 of file TGo4ThreadManager.h.

References fbAppBlocking.

◆ IsBeingQuit()

Bool_t TGo4ThreadManager::IsBeingQuit ( ) const
inline

Returns true if threadmanager works in root system blocking mode

Definition at line 74 of file TGo4ThreadManager.h.

References fbBeingQuit.

Referenced by TGo4TaskOwner::IsBeingQuit().

◆ IsInitDone()

Bool_t TGo4ThreadManager::IsInitDone ( ) const
inline

Definition at line 63 of file TGo4ThreadManager.h.

References fbInitDone.

◆ IsTerminateApp()

Bool_t TGo4ThreadManager::IsTerminateApp ( ) const
inline

Definition at line 68 of file TGo4ThreadManager.h.

References fbTerminateApplication.

Referenced by TGo4AppControlTimer::Notify().

◆ IsTerminating()

Bool_t TGo4ThreadManager::IsTerminating ( ) const
inline

◆ Launch()

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 TGo4ThreadHandler::CreateAll(), fbAutoCreate, fxBlocker, fxWorkHandler, and GO4TRACE.

Referenced by TGo4AnalysisClient::Constructor(), SetBeingQuit(), TGo4ClientTask::TGo4ClientTask(), TGo4Display::TGo4Display(), TGo4ExampleClient::TGo4ExampleClient(), TGo4ExampleServer::TGo4ExampleServer(), TGo4ServerTask::TGo4ServerTask(), and TGo4TestThreadManager::TGo4TestThreadManager().

◆ SetBeingQuit()

void TGo4ThreadManager::SetBeingQuit ( Bool_t  on)
inline

◆ SetTimer()

void TGo4ThreadManager::SetTimer ( TGo4AppControlTimer ctrltimer)
inline

user can exchange the standard control timer by an own derived one by this method

Definition at line 45 of file TGo4ThreadManager.h.

References fxBlocker.

◆ Terminate()

void TGo4ThreadManager::Terminate ( Bool_t  termapp = kTRUE)
virtual

deletes the Manager instance via Control timer. If termap is true, also terminates the root Application

Reimplemented in TGo4Task.

Definition at line 228 of file TGo4ThreadManager.cxx.

References TGo4Log::Debug(), fbTerminateApplication, fbTerminating, fxWorkHandler, GO4TRACE, TGo4ThreadHandler::StopAll(), and UnBlockApp().

Referenced by TGo4TerminateException::Handle(), SetBeingQuit(), TGo4Task::Terminate(), TerminateFast(), and TGo4Runnable::UnexpectedCatch().

◆ TerminateFast()

void TGo4ThreadManager::TerminateFast ( )
virtual

Alternative termination in case of error

Reimplemented in TGo4Task.

Definition at line 242 of file TGo4ThreadManager.cxx.

References Terminate().

Referenced by SetBeingQuit(), and TGo4Task::TerminateFast().

◆ UnBlockApp()

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, TGo4AppControlTimer::GetApplicationRun(), TGo4AppControlTimer::GetCondition(), GO4TRACE, and TGo4AppControlTimer::SetApplicationRun().

Referenced by TGo4ThreadHandler::Cancel(), TGo4ThreadHandler::Create(), TGo4ThreadHandler::CreateAll(), GetWorkHandler(), TGo4ThreadHandler::ReCreate(), TGo4ThreadHandler::RemoveThread(), TGo4TestRunnable::Run(), TGo4ThreadHandler::Start(), TGo4ThreadHandler::StartAll(), and Terminate().

Member Data Documentation

◆ fbAppBlocking

Bool_t TGo4ThreadManager::fbAppBlocking {kFALSE}
protected

true if threadmanager shall block root gSystem using the AppControlTimer; false if gSystem shall never be blocked (necessary for gui)

Definition at line 114 of file TGo4ThreadManager.h.

Referenced by BlockApp(), IsAppBlocking(), TGo4ThreadManager(), and TGo4Task::UpdateStatus().

◆ fbAutoCreate

Bool_t TGo4ThreadManager::fbAutoCreate {kFALSE}
protected

If true, TThreads of all go4threads in list shall be created automatically on calling Launch().

Definition at line 118 of file TGo4ThreadManager.h.

Referenced by Initialization(), Launch(), TGo4ThreadManager(), and TGo4Task::UpdateStatus().

◆ fbAutoStart

Bool_t TGo4ThreadManager::fbAutoStart {kFALSE}
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 123 of file TGo4ThreadManager.h.

Referenced by Initialization(), TGo4ThreadManager(), and TGo4Task::UpdateStatus().

◆ fbBeingQuit

Int_t TGo4ThreadManager::fbBeingQuit {0}
protected

Definition at line 128 of file TGo4ThreadManager.h.

Referenced by IsBeingQuit(), and SetBeingQuit().

◆ fbInitDone

Bool_t TGo4ThreadManager::fbInitDone {kFALSE}
protected

is set kTRUE after first Initialize is done

Definition at line 102 of file TGo4ThreadManager.h.

Referenced by TGo4ClientTask::Initialization(), Initialization(), TGo4Task::Initialization(), IsInitDone(), and TGo4Task::UpdateStatus().

◆ fbTerminateApplication

Bool_t TGo4ThreadManager::fbTerminateApplication {kFALSE}
protected

If true, terminate complete application. If false, only terminate threadmanager instance.

Definition at line 109 of file TGo4ThreadManager.h.

Referenced by IsTerminateApp(), and Terminate().

◆ fbTerminating

Bool_t TGo4ThreadManager::fbTerminating {kFALSE}
protected

flag showing termination status

Definition at line 105 of file TGo4ThreadManager.h.

Referenced by BlockApp(), IsTerminating(), Terminate(), and TGo4Task::UpdateStatus().

◆ fglTIMERPERIOD

const Long_t TGo4ThreadManager::fglTIMERPERIOD = 200
static

Period in ms for the application control timer

Definition at line 94 of file TGo4ThreadManager.h.

Referenced by TGo4ThreadManager().

◆ fxBlocker

TGo4AppControlTimer* TGo4ThreadManager::fxBlocker {nullptr}
protected

Composition of Application control timer. 1 1

Definition at line 134 of file TGo4ThreadManager.h.

Referenced by BlockApp(), Launch(), SetTimer(), TGo4ThreadManager(), and UnBlockApp().

◆ fxWorkHandler

TGo4ThreadHandler* TGo4ThreadManager::fxWorkHandler {nullptr}
protected

The documentation for this class was generated from the following files: