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.309 by root, Wed Nov 19 15:29:57 2008 UTC vs.
Revision 1.310 by root, Wed Nov 19 16:01:32 2008 UTC

165static size_t cctx_stacksize = CORO_STACKSIZE; 165static size_t cctx_stacksize = CORO_STACKSIZE;
166static struct CoroAPI coroapi; 166static struct CoroAPI coroapi;
167static AV *main_mainstack; /* used to differentiate between $main and others */ 167static AV *main_mainstack; /* used to differentiate between $main and others */
168static JMPENV *main_top_env; 168static JMPENV *main_top_env;
169static HV *coro_state_stash, *coro_stash; 169static HV *coro_state_stash, *coro_stash;
170static CV *coro_run_cv;
171static volatile SV *coro_mortal; /* will be freed/thrown after next transfer */ 170static volatile SV *coro_mortal; /* will be freed/thrown after next transfer */
172 171
173static GV *irsgv; /* $/ */ 172static GV *irsgv; /* $/ */
174static GV *stdoutgv; /* *STDOUT */ 173static GV *stdoutgv; /* *STDOUT */
175static SV *rv_diehook; 174static SV *rv_diehook;
290 289
291/* for Coro.pm */ 290/* for Coro.pm */
292static SV *coro_current; 291static SV *coro_current;
293static SV *coro_readyhook; 292static SV *coro_readyhook;
294static AV *coro_ready [PRIO_MAX - PRIO_MIN + 1]; 293static AV *coro_ready [PRIO_MAX - PRIO_MIN + 1];
294static CV *cv_coro_run;
295static struct coro *coro_first; 295static struct coro *coro_first;
296#define coro_nready coroapi.nready 296#define coro_nready coroapi.nready
297 297
298/** lowlevel stuff **********************************************************/ 298/** lowlevel stuff **********************************************************/
299 299
2629 2629
2630 if (items > 1) 2630 if (items > 1)
2631 { 2631 {
2632 cb = coro_sv_2cv (ST (1)); 2632 cb = coro_sv_2cv (ST (1));
2633 2633
2634 if (!ix)
2635 {
2634 if (CvISXSUB (cb)) 2636 if (CvISXSUB (cb))
2635 croak ("Coro::State doesn't support XS functions as coroutine start, caught"); 2637 croak ("Coro::State doesn't support XS functions as coroutine start, caught");
2636 2638
2637 if (!CvROOT (cb)) 2639 if (!CvROOT (cb))
2638 croak ("Coro::State doesn't support autoloaded or undefined functions as coroutine start, caught"); 2640 croak ("Coro::State doesn't support autoloaded or undefined functions as coroutine start, caught");
2641 }
2639 } 2642 }
2640 2643
2641 Newz (0, coro, 1, struct coro); 2644 Newz (0, coro, 1, struct coro);
2642 coro->args = newAV (); 2645 coro->args = newAV ();
2643 coro->flags = CF_NEW; 2646 coro->flags = CF_NEW;
2656 av_extend (coro->args, items - 1 + ix); 2659 av_extend (coro->args, items - 1 + ix);
2657 2660
2658 if (ix) 2661 if (ix)
2659 { 2662 {
2660 av_push (coro->args, SvREFCNT_inc_NN ((SV *)cb)); 2663 av_push (coro->args, SvREFCNT_inc_NN ((SV *)cb));
2661 cb = coro_run_cv; 2664 cb = cv_coro_run;
2662 } 2665 }
2663 2666
2664 coro->startcv = (CV *)SvREFCNT_inc_NN ((SV *)cb); 2667 coro->startcv = (CV *)SvREFCNT_inc_NN ((SV *)cb);
2665 2668
2666 for (i = 2; i < items; i++) 2669 for (i = 2; i < items; i++)
2874 int i; 2877 int i;
2875 2878
2876 av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE); 2879 av_async_pool = coro_get_av (aTHX_ "Coro::async_pool", TRUE);
2877 sv_pool_rss = coro_get_sv (aTHX_ "Coro::POOL_RSS" , TRUE); 2880 sv_pool_rss = coro_get_sv (aTHX_ "Coro::POOL_RSS" , TRUE);
2878 sv_pool_size = coro_get_sv (aTHX_ "Coro::POOL_SIZE" , TRUE); 2881 sv_pool_size = coro_get_sv (aTHX_ "Coro::POOL_SIZE" , TRUE);
2879 coro_run_cv = get_cv (aTHX_ "Coro::_terminate", GV_ADD); 2882 cv_coro_run = get_cv (aTHX_ "Coro::_terminate", GV_ADD);
2880 coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE); 2883 coro_current = coro_get_sv (aTHX_ "Coro::current" , FALSE);
2881 SvREADONLY_on (coro_current); 2884 SvREADONLY_on (coro_current);
2882 2885
2883 coro_stash = gv_stashpv ("Coro", TRUE); 2886 coro_stash = gv_stashpv ("Coro", TRUE);
2884 2887

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines