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.376 by root, Fri Oct 2 20:48:04 2009 UTC vs.
Revision 1.380 by root, Sun Sep 12 03:06:38 2010 UTC

718 { 718 {
719 CV *cv = cx->blk_sub.cv; 719 CV *cv = cx->blk_sub.cv;
720 720
721 if (expect_true (CvDEPTH (cv))) 721 if (expect_true (CvDEPTH (cv)))
722 { 722 {
723 EXTEND (SP, 3);
723 PUSHs ((SV *)CvPADLIST (cv)); 724 PUSHs ((SV *)CvPADLIST (cv));
724 PUSHs (INT2PTR (SV *, (IV)CvDEPTH (cv))); 725 PUSHs (INT2PTR (SV *, (IV)CvDEPTH (cv)));
725 PUSHs ((SV *)cv); 726 PUSHs ((SV *)cv);
726 727
727 CvDEPTH (cv) = 0; 728 CvDEPTH (cv) = 0;
1823 { 1824 {
1824 /* nothing to schedule: call the idle handler */ 1825 /* nothing to schedule: call the idle handler */
1825 if (SvROK (sv_idle) 1826 if (SvROK (sv_idle)
1826 && SvOBJECT (SvRV (sv_idle))) 1827 && SvOBJECT (SvRV (sv_idle)))
1827 { 1828 {
1829 if (SvRV (sv_idle) == SvRV (coro_current))
1830 croak ("FATAL: $Coro::IDLE blocked itself - did you try to block inside an event loop callback? Caught");
1831
1828 ++coro_nready; /* hack so that api_ready doesn't invoke ready hook */ 1832 ++coro_nready; /* hack so that api_ready doesn't invoke ready hook */
1829 api_ready (aTHX_ SvRV (sv_idle)); 1833 api_ready (aTHX_ SvRV (sv_idle));
1830 --coro_nready; 1834 --coro_nready;
1831 } 1835 }
1832 else 1836 else
2418 if (PL_op->op_flags & OPf_STACKED) 2422 if (PL_op->op_flags & OPf_STACKED)
2419 { 2423 {
2420 if (items > slf_arga) 2424 if (items > slf_arga)
2421 { 2425 {
2422 slf_arga = items; 2426 slf_arga = items;
2423 free (slf_argv); 2427 Safefree (slf_argv);
2424 slf_argv = malloc (slf_arga * sizeof (SV *)); 2428 New (0, slf_argv, slf_arga, SV *);
2425 } 2429 }
2426 2430
2427 slf_argc = items; 2431 slf_argc = items;
2428 2432
2429 for (i = 0; i < items; ++i) 2433 for (i = 0; i < items; ++i)
2962 /* now call the AIO function - we assume our request is uncancelable */ 2966 /* now call the AIO function - we assume our request is uncancelable */
2963 PUTBACK; 2967 PUTBACK;
2964 call_sv ((SV *)req, G_VOID | G_DISCARD); 2968 call_sv ((SV *)req, G_VOID | G_DISCARD);
2965 } 2969 }
2966 2970
2967 /* now that the requets is going, we loop toll we have a result */ 2971 /* now that the request is going, we loop till we have a result */
2968 frame->data = (void *)state; 2972 frame->data = (void *)state;
2969 frame->prepare = prepare_schedule; 2973 frame->prepare = prepare_schedule;
2970 frame->check = slf_check_aio_req; 2974 frame->check = slf_check_aio_req;
2971} 2975}
2972 2976
3271 RETVAL = boolSV (coro->flags & ix); 3275 RETVAL = boolSV (coro->flags & ix);
3272 OUTPUT: 3276 OUTPUT:
3273 RETVAL 3277 RETVAL
3274 3278
3275void 3279void
3276throw (Coro::State self, SV *throw = &PL_sv_undef) 3280throw (Coro::State self, SV *exception = &PL_sv_undef)
3277 PROTOTYPE: $;$ 3281 PROTOTYPE: $;$
3278 CODE: 3282 CODE:
3279{ 3283{
3280 struct coro *current = SvSTATE_current; 3284 struct coro *current = SvSTATE_current;
3281 SV **throwp = self == current ? &CORO_THROW : &self->except; 3285 SV **exceptionp = self == current ? &CORO_THROW : &self->except;
3282 SvREFCNT_dec (*throwp); 3286 SvREFCNT_dec (*exceptionp);
3283 SvGETMAGIC (throw); 3287 SvGETMAGIC (exception);
3284 *throwp = SvOK (throw) ? newSVsv (throw) : 0; 3288 *exceptionp = SvOK (exception) ? newSVsv (exception) : 0;
3285} 3289}
3286 3290
3287void 3291void
3288api_trace (SV *coro, int flags = CC_TRACE | CC_TRACE_SUB) 3292api_trace (SV *coro, int flags = CC_TRACE | CC_TRACE_SUB)
3289 PROTOTYPE: $;$ 3293 PROTOTYPE: $;$

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines