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.378 by root, Sat Dec 12 01:30:26 2009 UTC vs.
Revision 1.381 by root, Sat Oct 23 09:28:50 2010 UTC

1/* this works around a bug in mingw32 providing a non-working setjmp */
2#define USE_NO_MINGW_SETJMP_TWO_ARGS
3
1#define NDEBUG 1 4#define NDEBUG 1
2 5
3#include "libcoro/coro.c" 6#include "libcoro/coro.c"
4 7
5#define PERL_NO_GET_CONTEXT 8#define PERL_NO_GET_CONTEXT
2422 if (PL_op->op_flags & OPf_STACKED) 2425 if (PL_op->op_flags & OPf_STACKED)
2423 { 2426 {
2424 if (items > slf_arga) 2427 if (items > slf_arga)
2425 { 2428 {
2426 slf_arga = items; 2429 slf_arga = items;
2427 free (slf_argv); 2430 Safefree (slf_argv);
2428 slf_argv = malloc (slf_arga * sizeof (SV *)); 2431 New (0, slf_argv, slf_arga, SV *);
2429 } 2432 }
2430 2433
2431 slf_argc = items; 2434 slf_argc = items;
2432 2435
2433 for (i = 0; i < items; ++i) 2436 for (i = 0; i < items; ++i)
2794 { 2797 {
2795 SV *cb_cv = s_get_cv_croak (arg [1]); 2798 SV *cb_cv = s_get_cv_croak (arg [1]);
2796 av_push (av, SvREFCNT_inc_NN (cb_cv)); 2799 av_push (av, SvREFCNT_inc_NN (cb_cv));
2797 2800
2798 if (SvIVX (AvARRAY (av)[0])) 2801 if (SvIVX (AvARRAY (av)[0]))
2799 coro_signal_wake (aTHX_ av, 1); /* ust be the only waiter */ 2802 coro_signal_wake (aTHX_ av, 1); /* must be the only waiter */
2800 2803
2801 frame->prepare = prepare_nop; 2804 frame->prepare = prepare_nop;
2802 frame->check = slf_check_nop; 2805 frame->check = slf_check_nop;
2803 } 2806 }
2804 else if (SvIVX (AvARRAY (av)[0])) 2807 else if (SvIVX (AvARRAY (av)[0]))
2966 /* now call the AIO function - we assume our request is uncancelable */ 2969 /* now call the AIO function - we assume our request is uncancelable */
2967 PUTBACK; 2970 PUTBACK;
2968 call_sv ((SV *)req, G_VOID | G_DISCARD); 2971 call_sv ((SV *)req, G_VOID | G_DISCARD);
2969 } 2972 }
2970 2973
2971 /* now that the requets is going, we loop toll we have a result */ 2974 /* now that the request is going, we loop till we have a result */
2972 frame->data = (void *)state; 2975 frame->data = (void *)state;
2973 frame->prepare = prepare_schedule; 2976 frame->prepare = prepare_schedule;
2974 frame->check = slf_check_aio_req; 2977 frame->check = slf_check_aio_req;
2975} 2978}
2976 2979
3275 RETVAL = boolSV (coro->flags & ix); 3278 RETVAL = boolSV (coro->flags & ix);
3276 OUTPUT: 3279 OUTPUT:
3277 RETVAL 3280 RETVAL
3278 3281
3279void 3282void
3280throw (Coro::State self, SV *throw = &PL_sv_undef) 3283throw (Coro::State self, SV *exception = &PL_sv_undef)
3281 PROTOTYPE: $;$ 3284 PROTOTYPE: $;$
3282 CODE: 3285 CODE:
3283{ 3286{
3284 struct coro *current = SvSTATE_current; 3287 struct coro *current = SvSTATE_current;
3285 SV **throwp = self == current ? &CORO_THROW : &self->except; 3288 SV **exceptionp = self == current ? &CORO_THROW : &self->except;
3286 SvREFCNT_dec (*throwp); 3289 SvREFCNT_dec (*exceptionp);
3287 SvGETMAGIC (throw); 3290 SvGETMAGIC (exception);
3288 *throwp = SvOK (throw) ? newSVsv (throw) : 0; 3291 *exceptionp = SvOK (exception) ? newSVsv (exception) : 0;
3289} 3292}
3290 3293
3291void 3294void
3292api_trace (SV *coro, int flags = CC_TRACE | CC_TRACE_SUB) 3295api_trace (SV *coro, int flags = CC_TRACE | CC_TRACE_SUB)
3293 PROTOTYPE: $;$ 3296 PROTOTYPE: $;$

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines