35 pthread_attr_t *attr =
new pthread_attr_t;
37 pthread_attr_init(attr);
40 det = (th->
fDetached) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE;
42 pthread_attr_setdetachstate(attr, det);
46 const size_t requiredStackSize = 1024*1024*2;
48 if (!pthread_attr_getstacksize(attr, &stackSize)
49 && stackSize < requiredStackSize) {
50 pthread_attr_setstacksize(attr, requiredStackSize);
55 pthread_attr_destroy(attr);
69 return pthread_join((pthread_t) th->
fId, ret);
88 return pthread_cancel((pthread_t) th->
fId);
97 return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
106 return pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
116 return pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
126 return pthread_setcanceltype (PTHREAD_CANCEL_DEFERRED, 0);
135 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &istate);
136 pthread_testcancel();
137 pthread_setcancelstate(istate, 0);
148 if (!
free)
Error(
"CleanUpPush",
"cleanup rountine = 0");
162 if (!
l->fRoutine)
Error(
"CleanUpPop",
"cleanup routine = 0");
163 if (exe &&
l->fRoutine) ((
void (*)(
void*))(
l->fRoutine))(
l->fArgument);
164 *
main =
l->fNext;
delete l;
184 return (
Long_t) pthread_self();
typedef void((*Func_t)())
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void Info(const char *method, const char *msgfmt,...) const
Issue info message.
TPosixThreadCleanUp(void **main, void *routine, void *arg)
cleanup function
TPosixThreadCleanUp * fNext
virtual Int_t SetCancelDeferred()
Set the cancellation response type of the calling thread to deferred, i.e.
virtual Int_t SetCancelOff()
Turn off the cancellation state of the calling thread.
virtual Int_t CleanUp(void **main)
Default thread cleanup routine.
virtual Int_t Kill(TThread *th)
Cancellation is the mechanism by which a thread can terminate the execution of another thread.
virtual Int_t SetCancelOn()
Turn on the cancellation state of the calling thread.
virtual Int_t SetCancelAsynchronous()
Set the cancellation response type of the calling thread to asynchronous, i.e.
virtual Int_t CancelPoint()
Introduce an explicit cancellation point. Returns 0.
virtual Int_t Join(TThread *th, void **ret)
Join suspends the execution of the calling thread until the thread identified by th terminates,...
virtual Int_t CleanUpPush(void **main, void *free, void *arg)
Add thread cleanup function.
virtual Int_t Exit(void *ret)
Terminates the execution of the calling thread. Return 0.
virtual Long_t SelfId()
Return the thread identifier for the calling thread.
virtual Int_t Run(TThread *th)
Create a pthread.
virtual Int_t CleanUpPop(void **main, Int_t exe)
Pop thread cleanup function from stack.
static void * Function(void *ptr)
Static method which is called by the system thread function and which in turn calls the actual user f...