v2.10-0 (21000JUN2005)

Go4ThreadManager
Class TGo4AppControlTimer


class TGo4AppControlTimer
derived from TTimer

Timer with main purpose to block the root
TApplication loop during thread execution. Moreover,
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.

Author:
J. Adamczewski, Go4 project-DVEE-GSI Darmstadt, Germany, j.adamczewski@gsi.de
Version: 0.9
Since: jul 2000-oct 2001

Field Summary
 private Bool_tfbApplicationRun
           
 protected static Int_tfgiTERMWAITCYCLES
          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
 protected static UInt_tfguTERMWAIT
          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 TCondition*fxCondition
           
 protected TGo4ThreadManager*fxManager
          Backlink to threadmanager who owns this timer.

Fields inherited from class TTimer
fTime, fAbsTime, fTimeout, fSync, fTimeID, fObject, fCommand

Constructor Summary
 TGo4AppControlTimer(const TGo4AppControlTimer& right)
           
 TGo4AppControlTimer(TGo4ThreadManager* manager, Long_t msperiod, Bool_t mode)
           
 private TGo4AppControlTimer()
           

Destructor Summary
 virtual synchronized ~TGo4AppControlTimer()
           

Method Summary
 Bool_tGetApplicationRun()
          Status of the application run flag.
 const const TCondition*GetCondition()
          Returns handle for internal condition which is
used to block the gSystem.
 virtual Bool_tNotify()
          Routine called from TTimer on timeout
 synchronized TGo4AppControlTimer&operator=(const TGo4AppControlTimer& right)
           
 voidSetApplicationRun(Bool_t flag)
          Switches between blocking and non blocking mode of the timer.
 voidSetManager(TGo4ThreadManager* parent)
          Sets reference to new thread manager

Methods inherited from class TTimer
CheckTimer, GetCommand, GetObject, GetTime, GetTimerID, GetAbsTime, HasTimedOut, IsSync, IsAsync, Add, Remove, Reset, SetCommand, SetObject, SetTime, SetTimerID, Start, Stop, TurnOn, TurnOff, Timeout, SingleShot, Class, Class_Name, Class_Version, Dictionary, IsA, ShowMembers, Streamer, StreamerNVirtual, DeclFileName, ImplFileLine, ImplFileName, DeclFileLine

Methods inherited from class TSysEvtHandler
Notified, Added, Removed

Field Detail

fbApplicationRun

private Bool_t fbApplicationRun

fgiTERMWAITCYCLES

protected static Int_t fgiTERMWAITCYCLES
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

fguTERMWAIT

protected static UInt_t fguTERMWAIT
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

fxCondition

private TCondition* fxCondition

fxManager

protected TGo4ThreadManager* fxManager
Backlink to threadmanager who owns this timer.
supplierCardinality 1
clientCardinality 1
Constructor Detail

TGo4AppControlTimer

public TGo4AppControlTimer(const TGo4AppControlTimer& right)

TGo4AppControlTimer

public TGo4AppControlTimer(TGo4ThreadManager* manager, Long_t msperiod, Bool_t mode)

TGo4AppControlTimer

private TGo4AppControlTimer()
Method Detail

~TGo4AppControlTimer

public virtual synchronized ~TGo4AppControlTimer()
Method Detail

GetApplicationRun

public Bool_t GetApplicationRun()
Status of the application run flag. If true, root application is _not_ blocked.

GetCondition

public const const TCondition* GetCondition()
Returns handle for internal condition which is
used to block the gSystem.

Notify

public virtual Bool_t Notify()
Routine called from TTimer on timeout

operator=

public synchronized TGo4AppControlTimer& operator=(const TGo4AppControlTimer& right)

SetApplicationRun

public void SetApplicationRun(Bool_t flag)
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.

SetManager

public void SetManager(TGo4ThreadManager* parent)
Sets reference to new thread manager

Association Links

to Class TGo4ThreadManager

Backlink to threadmanager who owns this timer.

Client Cardinality 1
Supplier Cardinality 1

to Class TCondition


J.Adamczewski, M.Al-Turany, D.Bertini, H.G.Essel, S.Linev

30-06-2005