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

Comparing Coro/Coro/State.xs (file contents):
Revision 1.333 by root, Thu Nov 27 12:39:00 2008 UTC vs.
Revision 1.344 by root, Mon Dec 15 19:39:40 2008 UTC

238enum { 238enum {
239 CF_RUNNING = 0x0001, /* coroutine is running */ 239 CF_RUNNING = 0x0001, /* coroutine is running */
240 CF_READY = 0x0002, /* coroutine is ready */ 240 CF_READY = 0x0002, /* coroutine is ready */
241 CF_NEW = 0x0004, /* has never been switched to */ 241 CF_NEW = 0x0004, /* has never been switched to */
242 CF_DESTROYED = 0x0008, /* coroutine data has been freed */ 242 CF_DESTROYED = 0x0008, /* coroutine data has been freed */
243 CF_SUSPENDED = 0x0010, /* coroutine can't be scheduled */
243}; 244};
244 245
245/* the structure where most of the perl state is stored, overlaid on the cxstack */ 246/* the structure where most of the perl state is stored, overlaid on the cxstack */
246typedef struct 247typedef struct
247{ 248{
285 /* async_pool */ 286 /* async_pool */
286 SV *saved_deffh; 287 SV *saved_deffh;
287 SV *invoke_cb; 288 SV *invoke_cb;
288 AV *invoke_av; 289 AV *invoke_av;
289 290
291 /* on_enter/on_leave */
292 AV *on_enter;
293 AV *on_leave;
294
290 /* linked list */ 295 /* linked list */
291 struct coro *next, *prev; 296 struct coro *next, *prev;
292}; 297};
293 298
294typedef struct coro *Coro__State; 299typedef struct coro *Coro__State;
352INLINE CV * 357INLINE CV *
353coro_sv_2cv (pTHX_ SV *sv) 358coro_sv_2cv (pTHX_ SV *sv)
354{ 359{
355 HV *st; 360 HV *st;
356 GV *gvp; 361 GV *gvp;
357 return sv_2cv (sv, &st, &gvp, 0); 362 CV *cv = sv_2cv (sv, &st, &gvp, 0);
363
364 if (!cv)
365 croak ("code reference expected");
366
367 return cv;
358} 368}
359 369
360/*****************************************************************************/ 370/*****************************************************************************/
361/* magic glue */ 371/* magic glue */
362 372
521} 531}
522 532
523/** load & save, init *******************************************************/ 533/** load & save, init *******************************************************/
524 534
525static void 535static void
536on_enterleave_call (pTHX_ SV *cb);
537
538static void
526load_perl (pTHX_ Coro__State c) 539load_perl (pTHX_ Coro__State c)
527{ 540{
528 perl_slots *slot = c->slot; 541 perl_slots *slot = c->slot;
529 c->slot = 0; 542 c->slot = 0;
530 543
556 PUTBACK; 569 PUTBACK;
557 } 570 }
558 571
559 slf_frame = c->slf_frame; 572 slf_frame = c->slf_frame;
560 CORO_THROW = c->except; 573 CORO_THROW = c->except;
574
575 if (expect_false (c->on_enter))
576 {
577 int i;
578
579 for (i = 0; i <= AvFILLp (c->on_enter); ++i)
580 on_enterleave_call (aTHX_ AvARRAY (c->on_enter)[i]);
581 }
561} 582}
562 583
563static void 584static void
564save_perl (pTHX_ Coro__State c) 585save_perl (pTHX_ Coro__State c)
565{ 586{
587 if (expect_false (c->on_leave))
588 {
589 int i;
590
591 for (i = AvFILLp (c->on_leave); i >= 0; --i)
592 on_enterleave_call (aTHX_ AvARRAY (c->on_leave)[i]);
593 }
594
566 c->except = CORO_THROW; 595 c->except = CORO_THROW;
567 c->slf_frame = slf_frame; 596 c->slf_frame = slf_frame;
568 597
569 { 598 {
570 dSP; 599 dSP;
769#endif 798#endif
770 799
771/* 800/*
772 * This overrides the default magic get method of %SIG elements. 801 * This overrides the default magic get method of %SIG elements.
773 * The original one doesn't provide for reading back of PL_diehook/PL_warnhook 802 * The original one doesn't provide for reading back of PL_diehook/PL_warnhook
774 * and instead of tryign to save and restore the hash elements, we just provide 803 * and instead of trying to save and restore the hash elements, we just provide
775 * readback here. 804 * readback here.
776 * We only do this when the hook is != 0, as they are often set to 0 temporarily,
777 * not expecting this to actually change the hook. This is a potential problem
778 * when a schedule happens then, but we ignore this.
779 */ 805 */
780static int 806static int
781coro_sigelem_get (pTHX_ SV *sv, MAGIC *mg) 807coro_sigelem_get (pTHX_ SV *sv, MAGIC *mg)
782{ 808{
783 const char *s = MgPV_nolen_const (mg); 809 const char *s = MgPV_nolen_const (mg);
836 if (strEQ (s, "__WARN__")) svp = &PL_warnhook; 862 if (strEQ (s, "__WARN__")) svp = &PL_warnhook;
837 863
838 if (svp) 864 if (svp)
839 { 865 {
840 SV *old = *svp; 866 SV *old = *svp;
841 *svp = newSVsv (sv); 867 *svp = SvOK (sv) ? newSVsv (sv) : 0;
842 SvREFCNT_dec (old); 868 SvREFCNT_dec (old);
843 return 0; 869 return 0;
844 } 870 }
845 } 871 }
846 872
938 /* copy throw, in case it was set before coro_setup */ 964 /* copy throw, in case it was set before coro_setup */
939 CORO_THROW = coro->except; 965 CORO_THROW = coro->except;
940} 966}
941 967
942static void 968static void
943coro_destruct (pTHX_ struct coro *coro) 969coro_unwind_stacks (pTHX)
944{ 970{
945 if (!IN_DESTRUCT) 971 if (!IN_DESTRUCT)
946 { 972 {
947 /* restore all saved variables and stuff */ 973 /* restore all saved variables and stuff */
948 LEAVE_SCOPE (0); 974 LEAVE_SCOPE (0);
956 POPSTACK_TO (PL_mainstack); 982 POPSTACK_TO (PL_mainstack);
957 983
958 /* unwind main stack */ 984 /* unwind main stack */
959 dounwind (-1); 985 dounwind (-1);
960 } 986 }
987}
988
989static void
990coro_destruct_perl (pTHX_ struct coro *coro)
991{
992 coro_unwind_stacks (aTHX);
961 993
962 SvREFCNT_dec (GvSV (PL_defgv)); 994 SvREFCNT_dec (GvSV (PL_defgv));
963 SvREFCNT_dec (GvAV (PL_defgv)); 995 SvREFCNT_dec (GvAV (PL_defgv));
964 SvREFCNT_dec (GvSV (PL_errgv)); 996 SvREFCNT_dec (GvSV (PL_errgv));
965 SvREFCNT_dec (PL_defoutgv); 997 SvREFCNT_dec (PL_defoutgv);
1277cctx_destroy (coro_cctx *cctx) 1309cctx_destroy (coro_cctx *cctx)
1278{ 1310{
1279 if (!cctx) 1311 if (!cctx)
1280 return; 1312 return;
1281 1313
1282 assert (cctx != cctx_current);//D temporary 1314 assert (("FATAL: tried to destroy current cctx", cctx != cctx_current));//D temporary?
1283 1315
1284 --cctx_count; 1316 --cctx_count;
1285 coro_destroy (&cctx->cctx); 1317 coro_destroy (&cctx->cctx);
1286 1318
1287 /* coro_transfer creates new, empty cctx's */ 1319 /* coro_transfer creates new, empty cctx's */
1351 /* TODO: throwing up here is considered harmful */ 1383 /* TODO: throwing up here is considered harmful */
1352 1384
1353 if (expect_true (prev != next)) 1385 if (expect_true (prev != next))
1354 { 1386 {
1355 if (expect_false (!(prev->flags & (CF_RUNNING | CF_NEW)))) 1387 if (expect_false (!(prev->flags & (CF_RUNNING | CF_NEW))))
1356 croak ("Coro::State::transfer called with a suspended prev Coro::State, but can only transfer from running or new states,"); 1388 croak ("Coro::State::transfer called with a blocked prev Coro::State, but can only transfer from running or new states,");
1357 1389
1358 if (expect_false (next->flags & CF_RUNNING))
1359 croak ("Coro::State::transfer called with running next Coro::State, but can only transfer to inactive states,");
1360
1361 if (expect_false (next->flags & CF_DESTROYED)) 1390 if (expect_false (next->flags & (CF_RUNNING | CF_DESTROYED | CF_SUSPENDED)))
1362 croak ("Coro::State::transfer called with destroyed next Coro::State, but can only transfer to inactive states,"); 1391 croak ("Coro::State::transfer called with running, destroyed or suspended next Coro::State, but can only transfer to inactive states,");
1363 1392
1364#if !PERL_VERSION_ATLEAST (5,10,0) 1393#if !PERL_VERSION_ATLEAST (5,10,0)
1365 if (expect_false (PL_lex_state != LEX_NOTPARSING)) 1394 if (expect_false (PL_lex_state != LEX_NOTPARSING))
1366 croak ("Coro::State::transfer called while parsing, but this is not supported in your perl version,"); 1395 croak ("Coro::State::transfer called while parsing, but this is not supported in your perl version,");
1367#endif 1396#endif
1405 coro_setup (aTHX_ next); 1434 coro_setup (aTHX_ next);
1406 } 1435 }
1407 else 1436 else
1408 load_perl (aTHX_ next); 1437 load_perl (aTHX_ next);
1409 1438
1410 assert (!prev->cctx);//D temporary
1411
1412 /* possibly untie and reuse the cctx */ 1439 /* possibly untie and reuse the cctx */
1413 if (expect_true ( 1440 if (expect_true (
1414 cctx_current->idle_sp == STACKLEVEL 1441 cctx_current->idle_sp == STACKLEVEL
1415 && !(cctx_current->flags & CC_TRACE) 1442 && !(cctx_current->flags & CC_TRACE)
1416 && !force_cctx 1443 && !force_cctx
1457coro_state_destroy (pTHX_ struct coro *coro) 1484coro_state_destroy (pTHX_ struct coro *coro)
1458{ 1485{
1459 if (coro->flags & CF_DESTROYED) 1486 if (coro->flags & CF_DESTROYED)
1460 return 0; 1487 return 0;
1461 1488
1462 if (coro->on_destroy) 1489 if (coro->on_destroy && !PL_dirty)
1463 coro->on_destroy (aTHX_ coro); 1490 coro->on_destroy (aTHX_ coro);
1464 1491
1465 coro->flags |= CF_DESTROYED; 1492 coro->flags |= CF_DESTROYED;
1466 1493
1467 if (coro->flags & CF_READY) 1494 if (coro->flags & CF_READY)
1471 --coro_nready; 1498 --coro_nready;
1472 } 1499 }
1473 else 1500 else
1474 coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */ 1501 coro->flags |= CF_READY; /* make sure it is NOT put into the readyqueue */
1475 1502
1476 if (coro->mainstack && coro->mainstack != main_mainstack) 1503 if (coro->mainstack
1504 && coro->mainstack != main_mainstack
1505 && coro->slot
1506 && !PL_dirty)
1477 { 1507 {
1478 struct coro temp; 1508 struct coro *current = SvSTATE_current;
1479 1509
1480 assert (("FATAL: tried to destroy currently running coroutine (please report)", !(coro->flags & CF_RUNNING))); 1510 assert (("FATAL: tried to destroy currently running coroutine", coro->mainstack != PL_mainstack));
1481 1511
1482 save_perl (aTHX_ &temp); 1512 save_perl (aTHX_ current);
1483 load_perl (aTHX_ coro); 1513 load_perl (aTHX_ coro);
1484 1514
1485 coro_destruct (aTHX_ coro); 1515 coro_destruct_perl (aTHX_ coro);
1486 1516
1487 load_perl (aTHX_ &temp); 1517 load_perl (aTHX_ current);
1488 1518
1489 coro->slot = 0; 1519 coro->slot = 0;
1490 } 1520 }
1491 1521
1492 cctx_destroy (coro->cctx); 1522 cctx_destroy (coro->cctx);
1673 if (expect_true (next_sv)) 1703 if (expect_true (next_sv))
1674 { 1704 {
1675 struct coro *next = SvSTATE_hv (next_sv); 1705 struct coro *next = SvSTATE_hv (next_sv);
1676 1706
1677 /* cannot transfer to destroyed coros, skip and look for next */ 1707 /* cannot transfer to destroyed coros, skip and look for next */
1678 if (expect_false (next->flags & CF_DESTROYED)) 1708 if (expect_false (next->flags & (CF_DESTROYED | CF_SUSPENDED)))
1679 SvREFCNT_dec (next_sv); /* coro_nready has already been taken care of by destroy */ 1709 SvREFCNT_dec (next_sv); /* coro_nready has already been taken care of by destroy */
1680 else 1710 else
1681 { 1711 {
1682 next->flags &= ~CF_READY; 1712 next->flags &= ~CF_READY;
1683 --coro_nready; 1713 --coro_nready;
1862 av_push (av_destroy, (SV *)newRV_inc ((SV *)hv)); /* RVinc for perl */ 1892 av_push (av_destroy, (SV *)newRV_inc ((SV *)hv)); /* RVinc for perl */
1863 api_ready (aTHX_ sv_manager); 1893 api_ready (aTHX_ sv_manager);
1864 1894
1865 frame->prepare = prepare_schedule; 1895 frame->prepare = prepare_schedule;
1866 frame->check = slf_check_repeat; 1896 frame->check = slf_check_repeat;
1897
1898 /* as a minor optimisation, we could unwind all stacks here */
1899 /* but that puts extra pressure on pp_slf, and is not worth much */
1900 /*coro_unwind_stacks (aTHX);*/
1867} 1901}
1868 1902
1869/*****************************************************************************/ 1903/*****************************************************************************/
1870/* async pool handler */ 1904/* async pool handler */
1871 1905
2290 2324
2291 PL_op->op_ppaddr = pp_slf; 2325 PL_op->op_ppaddr = pp_slf;
2292 /*PL_op->op_type = OP_CUSTOM; /* we do behave like entersub still */ 2326 /*PL_op->op_type = OP_CUSTOM; /* we do behave like entersub still */
2293 2327
2294 PL_op = (OP *)&slf_restore; 2328 PL_op = (OP *)&slf_restore;
2329}
2330
2331/*****************************************************************************/
2332/* dynamic wind */
2333
2334static void
2335on_enterleave_call (pTHX_ SV *cb)
2336{
2337 dSP;
2338
2339 PUSHSTACK;
2340
2341 PUSHMARK (SP);
2342 PUTBACK;
2343 call_sv (cb, G_VOID | G_DISCARD);
2344 SPAGAIN;
2345
2346 POPSTACK;
2347}
2348
2349static SV *
2350coro_avp_pop_and_free (pTHX_ AV **avp)
2351{
2352 AV *av = *avp;
2353 SV *res = av_pop (av);
2354
2355 if (AvFILLp (av) < 0)
2356 {
2357 *avp = 0;
2358 SvREFCNT_dec (av);
2359 }
2360
2361 return res;
2362}
2363
2364static void
2365coro_pop_on_enter (pTHX_ void *coro)
2366{
2367 SV *cb = coro_avp_pop_and_free (aTHX_ &((struct coro *)coro)->on_enter);
2368 SvREFCNT_dec (cb);
2369}
2370
2371static void
2372coro_pop_on_leave (pTHX_ void *coro)
2373{
2374 SV *cb = coro_avp_pop_and_free (aTHX_ &((struct coro *)coro)->on_leave);
2375 on_enterleave_call (aTHX_ sv_2mortal (cb));
2295} 2376}
2296 2377
2297/*****************************************************************************/ 2378/*****************************************************************************/
2298/* PerlIO::cede */ 2379/* PerlIO::cede */
2299 2380
2997 eval = 1 3078 eval = 1
2998 CODE: 3079 CODE:
2999{ 3080{
3000 if (coro->mainstack && ((coro->flags & CF_RUNNING) || coro->slot)) 3081 if (coro->mainstack && ((coro->flags & CF_RUNNING) || coro->slot))
3001 { 3082 {
3002 struct coro temp; 3083 struct coro *current = SvSTATE_current;
3003 3084
3004 if (!(coro->flags & CF_RUNNING)) 3085 if (current != coro)
3005 { 3086 {
3006 PUTBACK; 3087 PUTBACK;
3007 save_perl (aTHX_ &temp); 3088 save_perl (aTHX_ current);
3008 load_perl (aTHX_ coro); 3089 load_perl (aTHX_ coro);
3090 SPAGAIN;
3009 } 3091 }
3010 3092
3011 {
3012 dSP;
3013 ENTER;
3014 SAVETMPS;
3015 PUTBACK;
3016 PUSHSTACK; 3093 PUSHSTACK;
3094
3017 PUSHMARK (SP); 3095 PUSHMARK (SP);
3096 PUTBACK;
3018 3097
3019 if (ix) 3098 if (ix)
3020 eval_sv (coderef, 0); 3099 eval_sv (coderef, 0);
3021 else 3100 else
3022 call_sv (coderef, G_KEEPERR | G_EVAL | G_VOID | G_DISCARD); 3101 call_sv (coderef, G_KEEPERR | G_EVAL | G_VOID | G_DISCARD);
3023 3102
3024 POPSTACK; 3103 POPSTACK;
3025 SPAGAIN; 3104 SPAGAIN;
3026 FREETMPS;
3027 LEAVE;
3028 PUTBACK;
3029 }
3030 3105
3031 if (!(coro->flags & CF_RUNNING)) 3106 if (current != coro)
3032 { 3107 {
3108 PUTBACK;
3033 save_perl (aTHX_ coro); 3109 save_perl (aTHX_ coro);
3034 load_perl (aTHX_ &temp); 3110 load_perl (aTHX_ current);
3035 SPAGAIN; 3111 SPAGAIN;
3036 } 3112 }
3037 } 3113 }
3038} 3114}
3039 3115
3043 ALIAS: 3119 ALIAS:
3044 is_ready = CF_READY 3120 is_ready = CF_READY
3045 is_running = CF_RUNNING 3121 is_running = CF_RUNNING
3046 is_new = CF_NEW 3122 is_new = CF_NEW
3047 is_destroyed = CF_DESTROYED 3123 is_destroyed = CF_DESTROYED
3124 is_suspended = CF_SUSPENDED
3048 CODE: 3125 CODE:
3049 RETVAL = boolSV (coro->flags & ix); 3126 RETVAL = boolSV (coro->flags & ix);
3050 OUTPUT: 3127 OUTPUT:
3051 RETVAL 3128 RETVAL
3052 3129
3117 SV **dst = ix ? (SV **)&self->slot->defav : (SV **)&self->slot->defsv; 3194 SV **dst = ix ? (SV **)&self->slot->defav : (SV **)&self->slot->defsv;
3118 3195
3119 SV *tmp = *src; *src = *dst; *dst = tmp; 3196 SV *tmp = *src; *src = *dst; *dst = tmp;
3120 } 3197 }
3121 3198
3199void
3200cancel (Coro::State self)
3201 CODE:
3202 coro_state_destroy (aTHX_ self);
3203 coro_call_on_destroy (aTHX_ self); /* actually only for Coro objects */
3204
3122 3205
3123MODULE = Coro::State PACKAGE = Coro 3206MODULE = Coro::State PACKAGE = Coro
3124 3207
3125BOOT: 3208BOOT:
3126{ 3209{
3127 int i; 3210 int i;
3128 3211
3129 sv_pool_rss = coro_get_sv (aTHX_ "Coro::POOL_RSS" , TRUE); 3212 sv_pool_rss = coro_get_sv (aTHX_ "Coro::POOL_RSS" , TRUE);
3130 sv_pool_size = coro_get_sv (aTHX_ "Coro::POOL_SIZE" , TRUE); 3213 sv_pool_size = coro_get_sv (aTHX_ "Coro::POOL_SIZE" , TRUE);
3131 cv_coro_run = get_cv ( "Coro::_terminate", GV_ADD); 3214 cv_coro_run = get_cv ( "Coro::_coro_run" , GV_ADD);
3132 cv_coro_terminate = get_cv ( "Coro::terminate" , GV_ADD); 3215 cv_coro_terminate = get_cv ( "Coro::terminate" , GV_ADD);
3133 coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE); SvREADONLY_on (coro_current); 3216 coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE); SvREADONLY_on (coro_current);
3134 av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE); 3217 av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE);
3135 av_destroy = coro_get_av (aTHX_ "Coro::destroy" , TRUE); 3218 av_destroy = coro_get_av (aTHX_ "Coro::destroy" , TRUE);
3136 sv_manager = coro_get_sv (aTHX_ "Coro::manager" , TRUE); 3219 sv_manager = coro_get_sv (aTHX_ "Coro::manager" , TRUE);
3198 3281
3199void 3282void
3200cede_notself (...) 3283cede_notself (...)
3201 CODE: 3284 CODE:
3202 CORO_EXECUTE_SLF_XS (slf_init_cede_notself); 3285 CORO_EXECUTE_SLF_XS (slf_init_cede_notself);
3203
3204void
3205_cancel (Coro::State self)
3206 CODE:
3207 coro_state_destroy (aTHX_ self);
3208 coro_call_on_destroy (aTHX_ self);
3209 3286
3210void 3287void
3211_set_current (SV *current) 3288_set_current (SV *current)
3212 PROTOTYPE: $ 3289 PROTOTYPE: $
3213 CODE: 3290 CODE:
3321rouse_wait (...) 3398rouse_wait (...)
3322 PROTOTYPE: ;$ 3399 PROTOTYPE: ;$
3323 PPCODE: 3400 PPCODE:
3324 CORO_EXECUTE_SLF_XS (slf_init_rouse_wait); 3401 CORO_EXECUTE_SLF_XS (slf_init_rouse_wait);
3325 3402
3403void
3404on_enter (SV *block)
3405 ALIAS:
3406 on_leave = 1
3407 PROTOTYPE: &
3408 CODE:
3409{
3410 struct coro *coro = SvSTATE_current;
3411 AV **avp = ix ? &coro->on_leave : &coro->on_enter;
3412
3413 block = (SV *)coro_sv_2cv (aTHX_ block);
3414
3415 if (!*avp)
3416 *avp = newAV ();
3417
3418 av_push (*avp, SvREFCNT_inc (block));
3419
3420 if (!ix)
3421 on_enterleave_call (aTHX_ block);
3422
3423 LEAVE; /* pp_entersub unfortunately forces an ENTER/LEAVE around xs calls */
3424 SAVEDESTRUCTOR_X (ix ? coro_pop_on_leave : coro_pop_on_enter, (void *)coro);
3425 ENTER; /* pp_entersub unfortunately forces an ENTER/LEAVE around xs calls */
3426}
3427
3326 3428
3327MODULE = Coro::State PACKAGE = PerlIO::cede 3429MODULE = Coro::State PACKAGE = PerlIO::cede
3328 3430
3329BOOT: 3431BOOT:
3330 PerlIO_define_layer (aTHX_ &PerlIO_cede); 3432 PerlIO_define_layer (aTHX_ &PerlIO_cede);
3340 GvSTASH (CvGV (cv)) 3442 GvSTASH (CvGV (cv))
3341 ); 3443 );
3342 OUTPUT: 3444 OUTPUT:
3343 RETVAL 3445 RETVAL
3344 3446
3345# helper for Coro::Channel 3447# helper for Coro::Channel and others
3346SV * 3448SV *
3347_alloc (int count) 3449_alloc (int count)
3348 CODE: 3450 CODE:
3349 RETVAL = coro_waitarray_new (aTHX_ count); 3451 RETVAL = coro_waitarray_new (aTHX_ count);
3350 OUTPUT: 3452 OUTPUT:
3408 for (i = 1; i <= wcount; ++i) 3510 for (i = 1; i <= wcount; ++i)
3409 PUSHs (sv_2mortal (newRV_inc (AvARRAY (av)[i]))); 3511 PUSHs (sv_2mortal (newRV_inc (AvARRAY (av)[i])));
3410 } 3512 }
3411} 3513}
3412 3514
3515MODULE = Coro::State PACKAGE = Coro::SemaphoreSet
3516
3517void
3518_may_delete (SV *sem, int count, int extra_refs)
3519 PPCODE:
3520{
3521 AV *av = (AV *)SvRV (sem);
3522
3523 if (SvREFCNT ((SV *)av) == 1 + extra_refs
3524 && AvFILLp (av) == 0 /* no waiters, just count */
3525 && SvIV (AvARRAY (av)[0]) == count)
3526 XSRETURN_YES;
3527
3528 XSRETURN_NO;
3529}
3530
3413MODULE = Coro::State PACKAGE = Coro::Signal 3531MODULE = Coro::State PACKAGE = Coro::Signal
3414 3532
3415SV * 3533SV *
3416new (SV *klass) 3534new (SV *klass)
3417 CODE: 3535 CODE:

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines