sigfillset(&fullmask);
if (sigprocmask(SIG_SETMASK, &fullmask, &oldmask) == -1)
croak("panic: sigprocmask");
- err = pthread_create(&self, pthread_attr_default, threadstart, (void*) thr);
+ err = pthread_create(&thr->self, pthread_attr_default,
+ threadstart, (void*) thr);
/* Go */
MUTEX_UNLOCK(&thr->mutex);
#endif
#define init_thread_intern(t) \
STMT_START { \
- t->Tself = (t); \
+ t->self = (t); \
(t)->i.next_run = (t)->i.prev_run = (t); \
(t)->i.wait_queue = 0; \
(t)->i.private = 0; \
#ifdef HAVE_THREAD_INTERN
init_thread_intern(thr);
#else
- self = pthread_self();
+ thr->self = pthread_self();
if (pthread_key_create(&thr_key, 0))
croak("panic: pthread_key_create");
#endif /* HAVE_THREAD_INTERN */
# define YIELD pthread_yield()
# define DETACH(t) \
STMT_START { \
- if (pthread_detach(&(t)->Tself)) { \
+ if (pthread_detach(&(t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
#ifndef DETACH
#define DETACH(t) \
STMT_START { \
- if (pthread_detach((t)->Tself)) { \
+ if (pthread_detach((t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
#ifndef JOIN
#define JOIN(t, avp) \
STMT_START { \
- if (pthread_join((t)->Tself, (void**)(avp))) \
+ if (pthread_join((t)->self, (void**)(avp))) \
croak("panic: pthread_join"); \
} STMT_END
#endif /* JOIN */
/* XXX Sort stuff, firstgv, secongv and so on? */
- perl_thread Tself;
SV * Toursv;
HV * Tcvcache;
+ perl_thread self; /* Underlying thread object */
U32 flags;
perl_mutex mutex; /* For the fields others can change */
U32 tid;
#undef dirty
#undef localizing
-#define self (thr->Tself)
#define oursv (thr->Toursv)
#define stack_base (thr->Tstack_base)
#define stack_sp (thr->Tstack_sp)
DuplicateHandle(GetCurrentProcess(),
GetCurrentThread(),
GetCurrentProcess(),
- &self,
+ &thr->self,
0,
FALSE,
DUPLICATE_SAME_ACCESS);
DWORD junk;
MUTEX_LOCK(&thr->mutex);
- self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
+ thr->self = CreateThread(NULL, 0, fn, (void*)thr, 0, &junk);
MUTEX_UNLOCK(&thr->mutex);
- return self ? 0 : -1;
+ return thr->self ? 0 : -1;
}
#define DETACH(t) \
STMT_START { \
- if (CloseHandle((t)->Tself) == 0) { \
+ if (CloseHandle((t)->self) == 0) { \
MUTEX_UNLOCK(&(t)->mutex); \
croak("panic: DETACH"); \
} \
#define JOIN(t, avp) \
STMT_START { \
- if ((WaitForSingleObject((t)->Tself,INFINITE) == WAIT_FAILED) \
- || (GetExitCodeThread((t)->Tself,(LPDWORD)(avp)) == 0)) \
+ if ((WaitForSingleObject((t)->self,INFINITE) == WAIT_FAILED) \
+ || (GetExitCodeThread((t)->self,(LPDWORD)(avp)) == 0)) \
croak("panic: JOIN"); \
} STMT_END