v2.10-0 (21000JUN2005)

Go4ThreadManager
Class TGo4ThreadManager

Direct Known Subclasses:
TGo4Task, TGo4TestThreadManager

class TGo4ThreadManager
derived from TNamed

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

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

Field Summary
 protected Bool_tfbAppBlocking
          true if threadmanager shall block root gSystem using
the AppControlTimer; false if gSystem shall never be
blocked (necessary for gui)
 protected Bool_tfbAutoCreate
          If true, TThreads of all go4threads in list shall be created automatically
on calling Launch().
 protected Bool_tfbAutoStart
          If true, workfunctions (runnable Run()) of all go4threads in list shall be
started automatically on Initialization.
 protected Bool_tfbInitDone
          is set kTRUE after first Initialize is done
 protected Bool_tfbTerminateApplication
          If true, terminate complete application.
 protected Bool_tfbTerminating
          flag showing termination status
 const static const Long_tfglTIMERPERIOD
          Period in ms for the application control timer
 const static const UInt_tfguTEXTLENGTH
          Default textlength for char arrays
 protected TGo4AppControlTimer*fxBlocker
          Composition of Application control timer.
 protected TGo4ThreadHandler*fxWorkHandler
          Thread handler aggregate (threadsafe list of go4 threads)

Fields inherited from class TNamed
fName, fTitle

Constructor Summary
 TGo4ThreadManager(const TGo4ThreadManager& right)
           
 TGo4ThreadManager(const char * name, Bool_t blockingmode, Bool_t autostart, Bool_t autocreate)
          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()
 private TGo4ThreadManager()
           

Destructor Summary
 virtual synchronized ~TGo4ThreadManager()
           

Method Summary
 Bool_tBlockApp()
          Blocks gSystem by means of the blocking timer
 TGo4ThreadHandler*GetWorkHandler()
          Access to ThreadHandler for working threads
 virtual Int_tInitialization()
           
 Bool_tIsAppBlocking()
          Returns true if threadmanager works in root system blocking mode
 const Bool_tIsInitDone()
           
 const Bool_tIsTerminateApp()
           
 const Bool_tIsTerminating()
          returns termination status of Threadmanager
 voidLaunch()
          This Method has to be called to create the startup threads and to
turn on the application control timer.
 synchronized TGo4ThreadManager&operator=(const TGo4ThreadManager& right)
           
 voidSetTimer(TGo4AppControlTimer* ctrltimer)
          user can exchange the standard control timer
by an own derived one by this method
 virtual voidTerminate(Bool_t termapp)
          deletes the Manager instance via Control timer.
 virtual voidTerminateFast()
          Alternative termination in case of error
 Bool_tUnBlockApp(Int_t mode)
          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)

Methods inherited from class TNamed
operator=, Clear, Clone, Compare, Copy, FillBuffer, GetName, GetTitle, Hash, IsSortable, SetName, SetNameTitle, SetTitle, ls, Print, Sizeof, Class, Class_Name, Class_Version, Dictionary, IsA, ShowMembers, Streamer, StreamerNVirtual, DeclFileName, ImplFileLine, ImplFileName, DeclFileLine

Field Detail

fbAppBlocking

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

fbAutoCreate

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

fbAutoStart

protected Bool_t fbAutoStart
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.

fbInitDone

protected Bool_t fbInitDone
is set kTRUE after first Initialize is done

fbTerminateApplication

protected Bool_t fbTerminateApplication
If true, terminate complete application. If false,
only terminate threadmanager instance.

fbTerminating

protected Bool_t fbTerminating
flag showing termination status

fglTIMERPERIOD

public const static const Long_t fglTIMERPERIOD
Period in ms for the application control timer

fguTEXTLENGTH

public const static const UInt_t fguTEXTLENGTH
Default textlength for char arrays

fxBlocker

protected TGo4AppControlTimer* fxBlocker
Composition of Application control timer.
supplierCardinality 1
link aggregationByValue
clientCardinality 1

fxWorkHandler

protected TGo4ThreadHandler* fxWorkHandler
Thread handler aggregate (threadsafe list of go4 threads)
supplierCardinality 1
link aggregationByValue
clientCardinality 1
Constructor Detail

TGo4ThreadManager

public TGo4ThreadManager(const TGo4ThreadManager& right)

TGo4ThreadManager

public TGo4ThreadManager(const char * name, Bool_t blockingmode, Bool_t autostart, Bool_t autocreate)
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()

TGo4ThreadManager

private TGo4ThreadManager()
Method Detail

~TGo4ThreadManager

public virtual synchronized ~TGo4ThreadManager()
Method Detail

BlockApp

public Bool_t BlockApp()
Blocks gSystem by means of the blocking timer

GetWorkHandler

public TGo4ThreadHandler* GetWorkHandler()
Access to ThreadHandler for working threads

Initialization

public virtual Int_t Initialization()

IsAppBlocking

public Bool_t IsAppBlocking()
Returns true if threadmanager works in root system blocking mode

IsInitDone

public const Bool_t IsInitDone()

IsTerminateApp

public const Bool_t IsTerminateApp()

IsTerminating

public const Bool_t IsTerminating()
returns termination status of Threadmanager

Launch

public void 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.

operator=

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

SetTimer

public void SetTimer(TGo4AppControlTimer* ctrltimer)
user can exchange the standard control timer
by an own derived one by this method

Terminate

public virtual void Terminate(Bool_t termapp)
deletes the Manager instance via Control timer.
If termap is true, also
terminates the root Application

TerminateFast

public virtual void TerminateFast()
Alternative termination in case of error

UnBlockApp

public Bool_t UnBlockApp(Int_t mode)
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)

Association Links

to Class TGo4AppControlTimer

Composition of Application control timer.

Client Cardinality 1
Supplier Cardinality 1
Type aggregationByValue

to Class TGo4ThreadHandler

Thread handler aggregate (threadsafe list of go4 threads)

Client Cardinality 1
Supplier Cardinality 1
Type aggregationByValue

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

30-06-2005