ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro-Multicore/Multicore.xs
(Generate patch)

Comparing Coro-Multicore/Multicore.xs (file contents):
Revision 1.24 by root, Tue Mar 5 12:31:27 2019 UTC vs.
Revision 1.25 by root, Wed Mar 6 16:39:45 2019 UTC

200} 200}
201 201
202static void 202static void
203pmapi_release (void) 203pmapi_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);
243pmapi_acquire (void) 243pmapi_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
336scoped_disable () 336scoped_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
342U32 344U32
343min_idle_threads (U32 min = NO_INIT) 345min_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
354int 357int
355fd () 358fd ()
356 CODE: 359 CODE:
357 RETVAL = s_epipe_fd (&ep); 360 RETVAL = s_epipe_fd (&ep);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines