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

Comparing Coro/EV/EV.xs (file contents):
Revision 1.8 by root, Fri Nov 23 16:40:06 2007 UTC vs.
Revision 1.9 by root, Mon Dec 3 00:41:46 2007 UTC

21#define ONCE_INIT AV *av = GvAV (PL_defgv); 21#define ONCE_INIT AV *av = GvAV (PL_defgv);
22#define ONCE_DONE av_clear (av); av_push (av, SvREFCNT_inc (CORO_CURRENT)); 22#define ONCE_DONE av_clear (av); av_push (av, SvREFCNT_inc (CORO_CURRENT));
23 23
24static struct ev_prepare scheduler; 24static struct ev_prepare scheduler;
25static struct ev_idle idler; 25static struct ev_idle idler;
26static int inhibit;
26 27
27static void 28static void
28idle_cb (struct ev_idle *w, int revents) 29idle_cb (struct ev_idle *w, int revents)
29{ 30{
30 ev_idle_stop (w); 31 ev_idle_stop (w);
32 33
33static void 34static void
34prepare_cb (struct ev_prepare *w, int revents) 35prepare_cb (struct ev_prepare *w, int revents)
35{ 36{
36 static int incede; 37 static int incede;
38
39 if (inhibit)
40 return;
37 41
38 ++incede; 42 ++incede;
39 43
40 CORO_CEDE_NOTSELF; 44 CORO_CEDE_NOTSELF;
41 45
59{ 63{
60 I_EV_API ("Coro::EV"); 64 I_EV_API ("Coro::EV");
61 I_CORO_API ("Coro::Event"); 65 I_CORO_API ("Coro::Event");
62 66
63 ev_prepare_init (&scheduler, prepare_cb); 67 ev_prepare_init (&scheduler, prepare_cb);
64 ev_prepare_start (&scheduler); 68 ev_prepare_start (EV_DEFAULT_ &scheduler);
65 ev_unref (); 69 ev_unref ();
66 70
67 ev_idle_init (&idler, idle_cb); 71 ev_idle_init (&idler, idle_cb);
68} 72}
73
74void
75_loop_oneshot ()
76 CODE:
77 ++inhibit;
78 ev_loop (EV_DEFAULT_ EVLOOP_ONESHOT);
79 --inhibit;
69 80
70void 81void
71_timed_io_once (...) 82_timed_io_once (...)
72 CODE: 83 CODE:
73{ 84{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines