… | |
… | |
200 | } |
200 | } |
201 | |
201 | |
202 | static void |
202 | static void |
203 | pmapi_release (void) |
203 | pmapi_release (void) |
204 | { |
204 | { |
|
|
205 | if (! ((thread_enable ? thread_enable : global_enable) & 1)) |
|
|
206 | { |
|
|
207 | X_TLS_SET (current_key, 0); |
|
|
208 | return; |
|
|
209 | } |
|
|
210 | |
205 | #if RECURSION_CHECK |
211 | #if RECURSION_CHECK |
206 | if (X_TLS_GET (check_key)) |
212 | if (X_TLS_GET (check_key)) |
207 | fatal ("FATAL: perlinterp_release () called without valid perl context"); |
213 | fatal ("FATAL: perlinterp_release () called without valid perl context"); |
208 | |
214 | |
209 | X_TLS_SET (check_key, &check_key); |
215 | X_TLS_SET (check_key, &check_key); |
210 | #endif |
216 | #endif |
211 | |
217 | |
212 | if (! ((thread_enable ? thread_enable : global_enable) & 1)) |
|
|
213 | { |
|
|
214 | X_TLS_SET (current_key, 0); |
|
|
215 | return; |
|
|
216 | } |
|
|
217 | |
|
|
218 | struct tctx *ctx = tctx_get (); |
218 | struct tctx *ctx = tctx_get (); |
219 | ctx->coro = SvREFCNT_inc_simple_NN (CORO_CURRENT); |
219 | ctx->coro = SvREFCNT_inc_simple_NN (CORO_CURRENT); |
220 | ctx->wait_f = 0; |
220 | ctx->wait_f = 0; |
221 | |
221 | |
222 | X_TLS_SET (current_key, ctx); |
222 | X_TLS_SET (current_key, ctx); |
… | |
… | |
243 | pmapi_acquire (void) |
243 | pmapi_acquire (void) |
244 | { |
244 | { |
245 | int jeret; |
245 | int jeret; |
246 | struct tctx *ctx = X_TLS_GET (current_key); |
246 | struct tctx *ctx = X_TLS_GET (current_key); |
247 | |
247 | |
|
|
248 | if (!ctx) |
|
|
249 | return; |
|
|
250 | |
248 | #if RECURSION_CHECK |
251 | #if RECURSION_CHECK |
249 | if (X_TLS_GET (check_key) != &check_key) |
252 | if (X_TLS_GET (check_key) != &check_key) |
250 | fatal ("FATAL: perlinterp_acquire () called with valid perl context"); |
253 | fatal ("FATAL: perlinterp_acquire () called with valid perl context"); |
251 | |
254 | |
252 | X_TLS_SET (check_key, 0); |
255 | X_TLS_SET (check_key, 0); |
253 | #endif |
256 | #endif |
254 | |
|
|
255 | if (!ctx) |
|
|
256 | return; |
|
|
257 | |
257 | |
258 | X_LOCK (acquire_m); |
258 | X_LOCK (acquire_m); |
259 | |
259 | |
260 | tctxs_put (&acquirers, ctx); |
260 | tctxs_put (&acquirers, ctx); |
261 | |
261 | |
… | |
… | |
336 | scoped_disable () |
336 | scoped_disable () |
337 | CODE: |
337 | CODE: |
338 | LEAVE; /* see Guard.xs */ |
338 | LEAVE; /* see Guard.xs */ |
339 | CORO_ENTERLEAVE_SCOPE_HOOK (set_thread_enable, (void *)2, set_thread_enable, (void *)0); |
339 | CORO_ENTERLEAVE_SCOPE_HOOK (set_thread_enable, (void *)2, set_thread_enable, (void *)0); |
340 | ENTER; /* see Guard.xs */ |
340 | ENTER; /* see Guard.xs */ |
|
|
341 | |
|
|
342 | #if 0 |
341 | |
343 | |
342 | U32 |
344 | U32 |
343 | min_idle_threads (U32 min = NO_INIT) |
345 | min_idle_threads (U32 min = NO_INIT) |
344 | CODE: |
346 | CODE: |
345 | X_LOCK (acquire_m); |
347 | X_LOCK (acquire_m); |
… | |
… | |
347 | if (items) |
349 | if (items) |
348 | min_idle = min; |
350 | min_idle = min; |
349 | X_UNLOCK (acquire_m); |
351 | X_UNLOCK (acquire_m); |
350 | OUTPUT: |
352 | OUTPUT: |
351 | RETVAL |
353 | RETVAL |
352 | |
354 | |
|
|
355 | #endif |
353 | |
356 | |
354 | int |
357 | int |
355 | fd () |
358 | fd () |
356 | CODE: |
359 | CODE: |
357 | RETVAL = s_epipe_fd (&ep); |
360 | RETVAL = s_epipe_fd (&ep); |