library: libThread
#include "TThread.h"

TThread


class description - header file - source file
viewCVS header - viewCVS source

class TThread: public TNamed

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
public:
TThread(Int_t id = 0)
TThread(TThread::VoidRtnFunc_t fn, void* arg = 0, TThread::EPriority pri = kNormalPriority)
TThread(const char* thname, TThread::VoidRtnFunc_t fn, void* arg = 0, TThread::EPriority pri = kNormalPriority)
virtual~TThread()
voidTObject::AbstractMethod(const char* method) const
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidTObject::Browse(TBrowser* b)
static Int_tCancelPoint()
static TClass*Class()
virtual const char*TObject::ClassName() const
static Int_tCleanUp()
static Int_tCleanUpPop(Int_t exe = 0)
static Int_tCleanUpPush(void* free, void* arg = 0)
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidDelete(Option_t* option = "")
static Int_tDelete(TThread* th)
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
static Int_tExists()
static Int_tExit(void* ret = 0)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
Long_tGetId() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
TThread::EPriorityGetPriority() const
TThread::EStateGetState() const
static TThread*GetThread(Long_t id)
static TThread*GetThread(const char* name)
static Int_tGetTime(ULong_t* absSec, ULong_t* absNanoSec)
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
Long_tJoin(void** ret = 0)
static Long_tJoin(Long_t id, void** ret = 0)
Int_tKill()
static Int_tKill(Long_t id)
static Int_tKill(const char* name)
static Int_tLock()
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
virtual voidTObject::Paint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidTNamed::Print(Option_t* option = "") const
static voidPrintf(const char* fmt)
static voidPs()
static voidps()
virtual Int_tTObject::Read(const char* name)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
Int_tRun(void* arg = 0)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidTObject::SavePrimitive(ostream& out, Option_t* option = "")
static TThread*Self()
static Long_tSelfId()
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
static Int_tSetCancelAsynchronous()
static Int_tSetCancelDeferred()
static Int_tSetCancelOff()
static Int_tSetCancelOn()
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
voidSetPriority(TThread::EPriority pri)
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
static Int_tSleep(ULong_t secs, ULong_t nanos = 0)
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
static Int_tTryLock()
static void**Tsd(void* dflt, Int_t k)
static Int_tUnLock()
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
static voidXAction()
protected:
voidTObject::MakeZombie()
private:
TThread(const TThread&)
static voidAfterCancel(TThread* th)
voidConstructor()
virtual voidDoError(Int_t level, const char* location, const char* fmt, va_list va) const
voidErrorHandler(int level, const char* location, const char* fmt, va_list ap) const
static void*Function(void* ptr)
static voidInit()
TThread&operator=(const TThread&)
voidSetComment(const char* txt = "0")
static Int_tXARequest(const char* xact, Int_t nb, void** ar, Int_t* iret)

Data Members

public:
enum EPriority { kLowPriority
kNormalPriority
kHighPriority
};
enum EState { kInvalidState
kNewState
kRunningState
kTerminatedState
kFinishedState
kCancelingState
kCanceledState
kDeletingState
};
enum TObject::EStatusBits { kCanDelete
kMustCleanup
kObjInCanvas
kIsReferenced
kHasUUID
kCannotPick
kNoContextMenu
kInvalidObject
};
enum TObject::[unnamed] { kIsOnHeap
kNotDeleted
kZombie
kBitMask
kSingleKey
kOverwrite
kWriteDelete
};
protected:
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title
private:
TThread*fNextpointer to next thread
TThread*fPrevpointer to prev thread
TThread**fHolderpointer to holder of this (delete only)
TThread::EPriorityfPrioritythread priority
TThread::EStatefStatethread state
TThread::EStatefStateComingcoming thread state
Long_tfIdthread id
Long_tfHandleWin32 thread handle
Bool_tfDetachedkTRUE if thread is Detached
Bool_tfNamedkTRUE if thread is Named
void*fFcnRetnvoid* start function of thread
void*fFcnVoidvoid start function of thread
void*fThreadArgthread start function arguments
void*fCleansupport of cleanup structure
void*fTsd[20]thread specific data container
charfComment[100]thread specific state comment
static TThreadImp*fgThreadImpstatic pointer to thread implementation
static char*fgXActAction name to do by main thread
static void**volatilefgXArrpointer to control array of void pointers for action
static Int_tfgXAnbsize of array above
static Int_tfgXArtreturn XA flag
static Long_tfgMainIdthread id of main thread
static TThread*fgMainpointer to chain of TThread's
static TMutex*fgMainMutexmutex to protect chain of threads
static TMutex*fgXActMutexmutex to protect XAction
static TCondition*fgXActCondicondition for XAction

Class Description

                                                                      
 TThread                                                              
                                                                      
 This class implements threads. A thread is an execution environment  
 much lighter than a process. A single process can have multiple      
 threads. The actual work is done via the TThreadImp class (either    
 TPosixThread or TWin32Thread).                                       
                                                                      

TThread(VoidRtnFunc_t fn, void *arg, EPriority pri)
 Create a thread. Specify the function or static class method
 to be executed by the thread and a pointer to the argument structure.
 The user function should return a void*. To start the thread call Run().
TThread(VoidFunc_t fn, void *arg, EPriority pri)
 Create a detached thread. Specify the function or class method
 to be executed by the thread and a pointer to the argument structure.
 To start the thread call Run().
TThread(const char *thname, VoidRtnFunc_t fn, void *arg, EPriority pri)
 Create thread with a name. Specify the function or class method
 to be executed by the thread and a pointer to the argument structure.
 The user function should return a void*. To start the thread call Run().
TThread(const char *thname, VoidFunc_t fn, void *arg, EPriority pri)
 Create a detached thread with a name. Specify the function or class
 method to be executed by the thread and a pointer to the argument
 structure. To start the thread call Run().
void Init()
 Initialize global state and variables once.
void Constructor()
 Common thread constructor.
~TThread()
 Cleanup the thread.
Int_t Delete(TThread *th)
 Static method to delete the specified thread.
Int_t Exists()
 Static method to check if threads exist.
 returns the number of running threads.
void SetPriority(EPriority pri)
 Set thread priority.
TThread * GetThread(Long_t id)
 Static method to find a thread by id.
TThread * GetThread(const char *name)
 Static method to find a thread by name.
TThread * Self()
 Static method returning pointer to current thread.
Long_t Join(void **ret)
 Join this thread.
Long_t Join(Long_t jid, void **ret)
 Static method to join a thread by id.
Long_t SelfId()
 Static method returning the id for the current thread.
Int_t Run(void *arg)
 Start the thread. This starts the static method TThread::Function()
 which calls the user function specified in the TThread ctor with
 the arg argument.
Int_t Kill()
 Kill this thread.
Int_t Kill(Long_t id)
 Static method to kill the thread by id.
Int_t Kill(const char *name)
 Static method to kill thread by name.
Int_t SetCancelOff()
 Static method to turn off thread cancellation.
Int_t SetCancelOn()
 Static method to turn on thread cancellation.
Int_t SetCancelAsynchronous()
 Static method to set asynchronous cancellation.
Int_t SetCancelDeferred()
 Static method to set deffered cancellation.
Int_t CancelPoint()
 Static method to set a cancellation point.
Int_t CleanUpPush(void *free, void *arg)
 Static method which pushes thread cleanup method on stack.
 Returns 0 in case of success and -1 in case of error.
Int_t CleanUpPop(Int_t exe)
 Static method which pops thread cleanup method off stack.
 Returns 0 in case of success and -1 in case of error.
Int_t CleanUp()
 Static method to cleanup the calling thread.
void AfterCancel(TThread *th)
 Static method which is called after the thread has been canceled.
Int_t Exit(void *ret)
 Static method which terminates the execution of the calling thread.
Int_t Sleep(ULong_t secs, ULong_t nanos)
 Static method to sleep the calling thread.
Int_t GetTime(ULong_t *absSec, ULong_t *absNanoSec)
 Static method to get the current time. Returns
 the number of seconds.
Int_t Lock()
 Static method to lock the main thread mutex.
Int_t TryLock()
 Static method to try to lock the main thread mutex.
Int_t UnLock()
 Static method to unlock the main thread mutex.
void * Function(void *ptr)
 Static method which is called by the system thread function and
 which in turn calls the actual user function.
void Ps()
 Static method listing the existing threads.
void ** Tsd(void *dflt, Int_t k)
 Static method returning a pointer to thread specific data container
 of the calling thread.
void Printf(const char *va_(fmt), ...)
 Static method providing a thread safe printf. Appends a newline.
void ErrorHandler(int level, const char *location, const char *fmt, va_list ap)
 Thread specific error handler function.
 It calls the user set error handler in the main thread.
void DoError(int level, const char *location, const char *fmt, va_list va)
 Interface to ErrorHandler. User has to specify the class name as
 part of the location, just like for the global Info(), Warning() and
 Error() functions.
Int_t XARequest(const char *xact, Int_t nb, void **ar, Int_t *iret)
 Static method used to allow commands to be executed by the main thread.
void XAction()
 Static method called via the thread timer to execute in the main
 thread certain commands. This to avoid sophisticated locking and
 possible deadlocking.
void SetComment(const char *txt = 0)
TThread& operator=(const TThread&)
void Delete(Option_t *option="")
{ TObject::Delete(option); }
EPriority GetPriority()
{ return fPriority; }
EState GetState()
{ return fState; }
Long_t GetId()
{ return fId; }
void ps()
{ Ps(); }

Author: Fons Rademakers 02/07/97
Last update: root/thread:$Name: $:$Id: TThread.cxx,v 1.48 2006/11/20 10:02:00 rdm Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.