37 class TThread :
public TNamed {
39 friend class TThreadImp;
40 friend class TPosixThread;
41 friend class TThreadTimer;
42 friend class TThreadCleaner;
43 friend class TWin32Thread;
44 friend class TThreadTearDownGuard;
45 friend class TJoinHelper;
49 typedef void *(*VoidRtnFunc_t)(
void *);
50 typedef void (*VoidFunc_t)(
void *);
81 VoidRtnFunc_t fFcnRetn;
87 static TThreadImp *fgThreadImp;
88 static char *
volatile fgXAct;
89 static void **
volatile fgXArr;
90 static volatile Int_t fgXAnb;
91 static volatile Int_t fgXArt;
92 static Long_t fgMainId;
93 static TThread *fgMain;
94 static TMutex *fgMainMutex;
95 static TMutex *fgXActMutex;
96 static TCondition *fgXActCondi;
100 void SetComment(
const char *txt = 0)
101 { fComment[0] = 0;
if (txt) { strncpy(fComment, txt, 99); fComment[99] = 0; } }
102 void DoError(Int_t level,
const char *location,
const char *fmt, va_list va)
const;
103 void ErrorHandler(
int level,
const char *location,
const char *fmt, va_list ap)
const;
105 static void *Function(
void *ptr);
106 static Int_t XARequest(
const char *xact, Int_t nb,
void **ar, Int_t *iret);
107 static void AfterCancel(TThread *th);
108 static void **GetTls(Int_t k);
110 TThread(
const TThread&);
111 TThread& operator=(
const TThread&);
114 TThread(VoidRtnFunc_t fn,
void *arg = 0, EPriority pri = kNormalPriority);
115 TThread(VoidFunc_t fn,
void *arg = 0, EPriority pri = kNormalPriority);
116 TThread(
const char *thname, VoidRtnFunc_t fn,
void *arg = 0, EPriority pri = kNormalPriority);
117 TThread(
const char *thname, VoidFunc_t fn,
void *arg = 0, EPriority pri = kNormalPriority);
118 TThread(Long_t
id = 0);
122 Int_t Run(
void *arg = 0);
123 void SetPriority(EPriority pri);
124 void Delete(Option_t *option=
"") { TObject::Delete(option); }
125 EPriority GetPriority()
const {
return fPriority; }
126 EState GetState()
const {
return fState; }
127 Long_t GetId()
const {
return fId; }
129 static void ps() { Ps(); }
131 static void Initialize();
132 static Bool_t IsInitialized();
134 Long_t Join(
void **ret = 0);
135 static Long_t Join(Long_t
id,
void **ret = 0);
137 static Int_t Exit(
void *ret = 0);
138 static Int_t Exists();
139 static TThread *GetThread(Long_t
id);
140 static TThread *GetThread(
const char *name);
143 static Int_t TryLock();
144 static Int_t UnLock();
145 static TThread *Self();
146 static Long_t SelfId();
147 static Int_t Sleep(ULong_t secs, ULong_t nanos = 0);
148 static Int_t GetTime(ULong_t *absSec, ULong_t *absNanoSec);
150 static Int_t Delete(TThread *&th);
151 static void **Tsd(
void *dflt, Int_t k);
158 static Int_t SetCancelOn();
159 static Int_t SetCancelOff();
160 static Int_t SetCancelAsynchronous();
161 static Int_t SetCancelDeferred();
162 static Int_t CancelPoint();
163 static Int_t Kill(Long_t
id);
164 static Int_t Kill(
const char *name);
165 static Int_t CleanUpPush(
void *free,
void *arg = 0);
166 static Int_t CleanUpPop(Int_t exe = 0);
167 static Int_t CleanUp();
170 static void Printf(
const char *fmt, ...)
171 #if defined(__GNUC__) && !defined(__CINT__)
172 __attribute__((format(printf, 1, 2)))
175 static void XAction();
187 class TThreadCleaner {
200 class TThreadTimer :
public TTimer {
205 TThreadTimer(Long_t ms = kItimerResolution + 10);