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.195 by root, Sat Oct 6 00:35:41 2007 UTC vs.
Revision 1.196 by root, Sat Oct 6 01:11:01 2007 UTC

219 /* statistics */ 219 /* statistics */
220 int usecount; /* number of transfers to this coro */ 220 int usecount; /* number of transfers to this coro */
221 221
222 /* coro process data */ 222 /* coro process data */
223 int prio; 223 int prio;
224 //SV *throw; 224 SV *throw;
225 225
226 /* async_pool */ 226 /* async_pool */
227 SV *saved_deffh; 227 SV *saved_deffh;
228 228
229 /* linked list */ 229 /* linked list */
608 PL_runops = RUNOPS_DEFAULT; 608 PL_runops = RUNOPS_DEFAULT;
609 PL_curcop = &PL_compiling; 609 PL_curcop = &PL_compiling;
610 PL_in_eval = EVAL_NULL; 610 PL_in_eval = EVAL_NULL;
611 PL_comppad = 0; 611 PL_comppad = 0;
612 PL_curpm = 0; 612 PL_curpm = 0;
613 PL_curpad = 1; 613 PL_curpad = 0;
614 PL_localizing = 0; 614 PL_localizing = 0;
615 PL_dirty = 0; 615 PL_dirty = 0;
616 PL_restartop = 0; 616 PL_restartop = 0;
617 617
618 GvSV (PL_defgv) = newSV (0); 618 GvSV (PL_defgv) = newSV (0);
619 GvAV (PL_defgv) = coro->args; coro->args = 0; 619 GvAV (PL_defgv) = coro->args; coro->args = 0;
620 GvSV (PL_errgv) = newSV (0); 620 GvSV (PL_errgv) = newSV (0);
621 GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0); 621 GvSV (irsgv) = newSVpvn ("\n", 1); sv_magic (GvSV (irsgv), (SV *)irsgv, PERL_MAGIC_sv, "/", 0);
622 PL_rs = newSVsv (GvSV (irsgv)); 622 PL_rs = newSVsv (GvSV (irsgv));
623 PL_defoutgv = SvREFCNT_inc (stdoutgv); 623 PL_defoutgv = (GV *)SvREFCNT_inc (stdoutgv);
624 624
625 { 625 {
626 dSP; 626 dSP;
627 LOGOP myop; 627 LOGOP myop;
628 628
667 SvREFCNT_dec (PL_defoutgv); 667 SvREFCNT_dec (PL_defoutgv);
668 SvREFCNT_dec (PL_rs); 668 SvREFCNT_dec (PL_rs);
669 SvREFCNT_dec (GvSV (irsgv)); 669 SvREFCNT_dec (GvSV (irsgv));
670 670
671 SvREFCNT_dec (coro->saved_deffh); 671 SvREFCNT_dec (coro->saved_deffh);
672 //SvREFCNT_dec (coro->throw); 672 SvREFCNT_dec (coro->throw);
673 673
674 coro_destroy_stacks (aTHX); 674 coro_destroy_stacks (aTHX);
675} 675}
676 676
677static void 677static void
1073 coro_transfer (&prev__cctx->cctx, &next->cctx->cctx); 1073 coro_transfer (&prev__cctx->cctx, &next->cctx->cctx);
1074 } 1074 }
1075 1075
1076 free_coro_mortal (aTHX); 1076 free_coro_mortal (aTHX);
1077 UNLOCK; 1077 UNLOCK;
1078
1079 if (expect_false (prev->throw || next->throw))
1080 {
1081 struct coro *coro = SvSTATE (coro_current);
1082
1083 if (coro->throw)
1084 {
1085 SV *exception = coro->throw;
1086 coro->throw = 0;
1087 sv_setsv (ERRSV, exception);
1088 croak (0);
1089 }
1090 }
1078 } 1091 }
1079} 1092}
1080 1093
1081struct transfer_args 1094struct transfer_args
1082{ 1095{
1722 CODE: 1735 CODE:
1723 RETVAL = coro_nready; 1736 RETVAL = coro_nready;
1724 OUTPUT: 1737 OUTPUT:
1725 RETVAL 1738 RETVAL
1726 1739
1740void
1741throw (Coro::State self, SV *throw = &PL_sv_undef)
1742 PROTOTYPE: $;$
1743 CODE:
1744 SvREFCNT_dec (self->throw);
1745 self->throw = SvOK (throw) ? newSVsv (throw) : 0;
1746
1727# for async_pool speedup 1747# for async_pool speedup
1728void 1748void
1729_pool_1 (SV *cb) 1749_pool_1 (SV *cb)
1730 CODE: 1750 CODE:
1731{ 1751{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines