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.4 by root, Thu Nov 1 08:28:58 2007 UTC vs.
Revision 1.5 by root, Wed Nov 7 20:40:30 2007 UTC

29{ 29{
30 ev_idle_stop (w); 30 ev_idle_stop (w);
31} 31}
32 32
33static void 33static void
34prepare_cb (struct ev_watcher *w, int revents) 34prepare_cb (struct ev_prepare *w, int revents)
35{ 35{
36 static int incede;
37
38 ++incede;
39
40 CORO_CEDE_NOTSELF;
41
36 while (CORO_NREADY && CORO_CEDE) 42 while (CORO_NREADY > incede && CORO_CEDE)
37 ; 43 ;
38 44
39 /* if still ready, then we have lower-priority coroutines. 45 /* if still ready, then we have lower-priority coroutines.
40 * cede once, then poll nonblocking 46 * poll anyways, but do not block.
41 */ 47 */
42 if (CORO_NREADY) 48 if (CORO_NREADY > incede && !ev_is_active (&idler))
43 { 49 ev_idle_start (&idler);
44 CORO_CEDE_NOTSELF;
45 50
46 if (CORO_NREADY) 51 --incede;
47 ev_idle_start (&idler);
48 }
49} 52}
50 53
51MODULE = Coro::EV PACKAGE = Coro::EV 54MODULE = Coro::EV PACKAGE = Coro::EV
52 55
53PROTOTYPES: ENABLE 56PROTOTYPES: ENABLE

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines