3 #define MUTEX_UNLOCK(m)
5 #define MUTEX_DESTROY(m)
8 #define COND_BROADCAST(c)
9 #define COND_WAIT(c, m)
10 #define COND_DESTROY(c)
13 /* Rats: if dTHR is just blank then the subsequent ";" throws an error */
14 #define dTHR extern int errno
18 #ifdef OLD_PTHREADS_API
19 #define pthread_mutexattr_init(a) pthread_mutexattr_create(a)
20 #define pthread_mutexattr_settype(a,t) pthread_mutexattr_setkind_np(a,t)
21 #define pthread_key_create(k,d) pthread_keycreate(k,(pthread_destructor_t)(d))
23 #define pthread_mutexattr_default NULL
24 #endif /* OLD_PTHREADS_API */
26 #define MUTEX_INIT(m) \
27 if (pthread_mutex_init((m), pthread_mutexattr_default)) \
28 croak("panic: MUTEX_INIT"); \
30 #define MUTEX_LOCK(m) \
31 if (pthread_mutex_lock((m))) croak("panic: MUTEX_LOCK"); else 1
32 #define MUTEX_UNLOCK(m) \
33 if (pthread_mutex_unlock((m))) croak("panic: MUTEX_UNLOCK"); else 1
34 #define MUTEX_DESTROY(m) \
35 if (pthread_mutex_destroy((m))) croak("panic: MUTEX_DESTROY"); else 1
36 #define COND_INIT(c) \
37 if (pthread_cond_init((c), NULL)) croak("panic: COND_INIT"); else 1
38 #define COND_SIGNAL(c) \
39 if (pthread_cond_signal((c))) croak("panic: COND_SIGNAL"); else 1
40 #define COND_BROADCAST(c) \
41 if (pthread_cond_broadcast((c))) croak("panic: COND_BROADCAST"); else 1
42 #define COND_WAIT(c, m) \
43 if (pthread_cond_wait((c), (m))) croak("panic: COND_WAIT"); else 1
44 #define COND_DESTROY(c) \
45 if (pthread_cond_destroy((c))) croak("panic: COND_DESTROY"); else 1
46 /* XXX Add "old" (?) POSIX draft interface too */
47 #ifdef OLD_PTHREADS_API
48 struct thread *getTHR _((void));
51 #define THR ((struct thread *) pthread_getspecific(thr_key))
52 #endif /* OLD_PTHREADS_API */
53 #define dTHR struct thread *thr = THR
58 /* The fields that used to be global */
85 char Tbuf[2048]; /* should be a global locked by a mutex */
86 char Ttokenbuf[256]; /* should be a global locked by a mutex */
90 /* XXX What about regexp stuff? */
92 /* Now the fields that used to be "per interpreter" (even when global) */
94 /* XXX What about magic variables such as $/, $? and so on? */
120 /* XXX Sort stuff, firstgv, secongv and so on? */
122 pthread_mutex_t * Tthreadstart_mutexp;
126 typedef struct thread *Thread;
138 #undef scopestack_max
156 #define self (thr->Tself)
157 #define stack_base (thr->Tstack_base)
158 #define stack_sp (thr->Tstack_sp)
159 #define stack_max (thr->Tstack_max)
160 #define op (thr->Top)
161 #define stack (thr->Tstack)
162 #define mainstack (thr->Tmainstack)
163 #define markstack (thr->Tmarkstack)
164 #define markstack_ptr (thr->Tmarkstack_ptr)
165 #define markstack_max (thr->Tmarkstack_max)
166 #define scopestack (thr->Tscopestack)
167 #define scopestack_ix (thr->Tscopestack_ix)
168 #define scopestack_max (thr->Tscopestack_max)
170 #define savestack (thr->Tsavestack)
171 #define savestack_ix (thr->Tsavestack_ix)
172 #define savestack_max (thr->Tsavestack_max)
174 #define retstack (thr->Tretstack)
175 #define retstack_ix (thr->Tretstack_ix)
176 #define retstack_max (thr->Tretstack_max)
178 #define cxstack (thr->Tcxstack)
179 #define cxstack_ix (thr->Tcxstack_ix)
180 #define cxstack_max (thr->Tcxstack_max)
182 #define curpad (thr->Tcurpad)
183 #define Sv (thr->TSv)
184 #define Xpv (thr->TXpv)
185 #define defstash (thr->Tdefstash)
186 #define curstash (thr->Tcurstash)
187 #define pad (thr->Tpad)
188 #define padname (thr->Tpadname)
190 #define tmps_stack (thr->Ttmps_stack)
191 #define tmps_ix (thr->Ttmps_ix)
192 #define tmps_floor (thr->Ttmps_floor)
193 #define tmps_max (thr->Ttmps_max)
195 #define in_eval (thr->Tin_eval)
196 #define restartop (thr->Trestartop)
197 #define delaymagic (thr->Tdelaymagic)
198 #define dirty (thr->Tdirty)
199 #define localizing (thr->Tlocalizing)
201 #define top_env (thr->Ttop_env)
202 #define runlevel (thr->Trunlevel)
204 #define threadstart_mutexp (thr->Tthreadstart_mutexp)
205 #define cvcache (thr->Tcvcache)
206 #endif /* USE_THREADS */