ROOT logo
Gled » GLEDCORE » GThread

class GThread


 POSIX thread wrapper class - Gled specific as it provides
 data members required for authorization and MIR processing.

Function Members (Methods)

public:
GThread(const GThread&)
GThread(const Text_t* name, GThread_foo foo, void* arg = 0, bool detached = false, bool detach_on_exit = false)
virtual~GThread()
static voidBlockAllSignals()
static voidBlockSignal(GThread::Signal sig)
intCancel()
static voidCancelAllThreads(bool join_p)
static GThread::CStateCancelOff()
static GThread::CStateCancelOn()
static TClass*Class()
voidCleanupPop(bool execute_p)
voidCleanupPush(GThread_cu_foo foo, void* arg)
boolClearDetachOnExit()
voidClearRootTThreadRepresentation()
intDetach()
static voidExit(void* ret = 0)
static voidFiniMain()
boolGetDetachOnExit()
pthread_tGetId()
intGetIndex()
static intGetMinStackSize()
const Text_t*GetName() const
intGetNice()
GThread::RStateGetRunningState()
intGetStackSize()
void*GetStartArg()
GThread_fooGetStartFoo()
GThread::TerminalPolicyGetTerminalPolicy() const
static GThread*InitMain()
static voidInvalidatePtr(GThread*& thr)
virtual TClass*IsA() const
boolIsDetached() const
static boolIsValidPtr(GThread* thr)
intJoin(void** tret = 0)
intKill(GThread::Signal signal = SigSTOP)
static voidListSignalState()
static voidListThreads()
static ZMIR*MIR()
GThread&operator=(const GThread&)
static ZMirEmittingEntity*Owner()
static const char*RunningStateName(GThread::RState state)
static GThread*Self()
static GThread::CStateSetCancelState(GThread::CState s)
static GThread::CTypeSetCancelType(GThread::CType t)
static GThread_sh_fooSetDefaultSignalHandler(GThread_sh_foo foo)
voidSetDetachOnExit(bool detachonexit)
static voidSetMinStackSize(int ss)
voidSetName(const Text_t* s)
voidSetNice(int nice)
static GThread_sh_fooSetSignalHandler(GThread::Signal sig, GThread_sh_foo foo, bool unblock = false)
voidSetStackSize(int stacksize)
voidSetStartArg(void* startarg)
voidSetStartFoo(GThread_foo startfoo)
voidSetTerminalPolicy(GThread::TerminalPolicy tp)
virtual voidShowMembers(TMemberInspector& insp)
static const char*SignalName(GThread::Signal sig)
intSpawn()
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
TStringStrName() const
static GThread::SignalSysToGledSignal(Int_t sys_sig)
static voidTestCancel()
static voidTheSignalHandler(GSignal* sig)
static voidToRootsSignalHandler(GSignal* sig)
static voidUnblockCpuExceptionSignals(bool unblock_fpe)
static voidUnblockSignal(GThread::Signal sig)
static intYield()
private:
GThread(const Text_t* name)
ZMIR*get_mir() const
ZMirEmittingEntity*get_owner() const
voidset_mir(ZMIR* mir)
voidset_owner(ZMirEmittingEntity* owner)
static voidthread_reaper(void* arg)
static void*thread_spawner(void* arg)

Data Members

public:
enum CState { CS_Enable
CS_Disable
};
enum CType { CT_Async
CT_Deferred
};
enum Signal { SigUNDEF
SigMIN
SigHUP
SigINT
SigQUIT
SigILL
SigTRAP
SigABRT
SigBUS
SigFPE
SigKILL
SigUSR1
SigSEGV
SigUSR2
SigPIPE
SigALRM
SigTERM
SigXXX1
SigCHLD
SigCONT
SigSTOP
SigTSTP
SigTTIN
SigTTOU
SigURG
SigXCPU
SigXFSZ
SigVTALRM
SigPROF
SigWINCH
SigIO
SigXXX2
SigSYS
SigMAX
SigMAXRT
};
enum RState { RS_Incubating
RS_Spawning
RS_Running
RS_Terminating
RS_Finished
RS_ErrorSpawning
};
enum TerminalPolicy { TP_ThreadExit
TP_GledExit
TP_SysExit
};
private:
static unsigned intTSD_Self
boolbDetachOnExitX{gs}
boolbDetached
list<GThread::Cleanup,allocator<GThread::Cleanup> >mCleanups
pthread_tmIdX{g} This will become GThreadInternalRep*
intmIndexX{g}
ZMIR*mMIR
TStringmNameX{Gs}
intmNiceX{gs}
ZMirEmittingEntity*mOwner
TThread*mRootTThread
GThread::RStatemRunningStateX{g}
GThread_sh_foomSigHandlerDefault
vector<void*>mSigHandlerVector
intmStackSizeX{gs}
void*mStartArgX{gs}
GThread_foomStartFooX{gs}
void*mTerminalContext
GThread::TerminalPolicymTerminalPolicy
intmTerminalSignal
list<GThread*,allocator<GThread*> >::iteratormThreadListIt
static GMutexsContainerLock
static GMutexsDetachCtrlLock
static GThread*sInvalidPtr
static GThread*sMainThread
static intsMinStackSize
static intsSigMap[32]
static intsThreadCount
static list<GThread*>sThreadList
static map<unsigned long,GThread*>sThreadMap

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

GThread(const Text_t* name)
 Private constructor for wrapping of existing threads.
 Thread is put into 'Running' state, registered into the thread list
 and assigned an internal thread-index.
 The owner of the thread is set to 0.
GThread(const Text_t* name, GThread_foo foo, void* arg = 0, bool detached = false, bool detach_on_exit = false)
 Normal constructor.
 Thread is put into 'Incubating' state, registered into the thread list
 and assigned an internal thread-index.
 The owner of the thread is set be the same as the owner of the calling thread.
 Termination policy is also copied.
~GThread()
 Destructor.
 Thread is unregistered from the thread list.
void CleanupPush(GThread_cu_foo foo, void* arg)
void CleanupPop(bool execute_p)
void* thread_spawner(void* arg)
void thread_reaper(void* arg)
int Spawn()
int Join(void** tret = 0)
int Kill(GThread::Signal signal = SigSTOP)
int Cancel()
int Detach()
bool IsDetached() const
bool ClearDetachOnExit()
void ClearRootTThreadRepresentation()
 Wipe root's TThread representation of the calling thread.
 This is needed as root's TSD schema expects TThread representation
 does not exist for whatever it calls the main thread.
 So we wipe it from the Root application thread.
int Yield()
void TestCancel()
void Exit(void* ret = 0)
GThread* Self()
 Static - returns current thread.
ZMirEmittingEntity* Owner()
 Static - returns owner of current thread.
ZMIR* MIR()
 Static - returns MIR processed in current thread.
void BlockAllSignals()
 Block all signals but the unblockable ones - KILL, STOP.
void UnblockCpuExceptionSignals(bool unblock_fpe)
 Unblock CPU exception signals SIGILL, SIGSEGV, SIGBUS
 and, if unblock_fpe is true, also SIGFPE.
void BlockSignal(GThread::Signal sig)
void UnblockSignal(GThread::Signal sig)
GThread_sh_foo SetDefaultSignalHandler(GThread_sh_foo foo)
GThread_sh_foo SetSignalHandler(GThread::Signal sig, GThread_sh_foo foo, bool unblock = false)
void TheSignalHandler(GSignal* sig)
void ToRootsSignalHandler(GSignal* sig)
 Root remaps signals in an even funnier way, see TUnixSystem.cxx.
void ListThreads()
void ListSignalState()
void CancelAllThreads(bool join_p)
GThread* InitMain()
 This will create a GThread wrapper around the calling thread.
 To be called from ::main thread, somewhere early during the
 system initialization.

 Blocks all signals but CPU exception ones.
 GThread signal handler is installed for USR1, USR2 and CPU exceptions.
void FiniMain()
int GetMinStackSize()
void SetMinStackSize(int ss)
const char* RunningStateName(GThread::RState state)
const char* SignalName(GThread::Signal sig)
void set_owner(ZMirEmittingEntity* owner)
{ mOwner = owner; }
ZMirEmittingEntity* get_owner() const
{ return mOwner; }
void set_mir(ZMIR* mir)
{ mMIR = mir; }
ZMIR* get_mir() const
{ return mMIR; }
GThread(const Text_t* name)
TerminalPolicy GetTerminalPolicy() const
{ return mTerminalPolicy; }
void SetTerminalPolicy(GThread::TerminalPolicy tp)
{ mTerminalPolicy = tp; }
CState SetCancelState(GThread::CState s)
CState CancelOn()
CState CancelOff()
CType SetCancelType(GThread::CType t)
Signal SysToGledSignal(Int_t sys_sig)
bool IsValidPtr(GThread* thr)
{ return thr != 0 && thr != sInvalidPtr; }
void InvalidatePtr(GThread*& thr)
{ thr = sInvalidPtr; }