ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.160 by root, Sat Dec 1 22:57:20 2007 UTC vs.
Revision 1.162 by root, Mon Dec 3 13:41:24 2007 UTC

886ev_backend (EV_P) 886ev_backend (EV_P)
887{ 887{
888 return backend; 888 return backend;
889} 889}
890 890
891unsigned int
892ev_loop_count (EV_P)
893{
894 return loop_count;
895}
896
891static void noinline 897static void noinline
892loop_init (EV_P_ unsigned int flags) 898loop_init (EV_P_ unsigned int flags)
893{ 899{
894 if (!backend) 900 if (!backend)
895 { 901 {
1342 ? EVUNLOOP_ONE 1348 ? EVUNLOOP_ONE
1343 : EVUNLOOP_CANCEL; 1349 : EVUNLOOP_CANCEL;
1344 1350
1345 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ 1351 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */
1346 1352
1347 while (expect_false (!activecnt)) 1353 do
1348 { 1354 {
1349#ifndef _WIN32 1355#ifndef _WIN32
1350 if (expect_false (curpid)) /* penalise the forking check even more */ 1356 if (expect_false (curpid)) /* penalise the forking check even more */
1351 if (expect_false (getpid () != curpid)) 1357 if (expect_false (getpid () != curpid))
1352 { 1358 {
1418#endif 1424#endif
1419 1425
1420 if (expect_false (block < 0.)) block = 0.; 1426 if (expect_false (block < 0.)) block = 0.;
1421 } 1427 }
1422 1428
1429 ++loop_count;
1423 backend_poll (EV_A_ block); 1430 backend_poll (EV_A_ block);
1424 } 1431 }
1425 1432
1426 /* update ev_rt_now, do magic */ 1433 /* update ev_rt_now, do magic */
1427 time_update (EV_A); 1434 time_update (EV_A);
1440 if (expect_false (checkcnt)) 1447 if (expect_false (checkcnt))
1441 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); 1448 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
1442 1449
1443 call_pending (EV_A); 1450 call_pending (EV_A);
1444 1451
1445 if (expect_false (loop_done))
1446 break;
1447 } 1452 }
1453 while (expect_true (activecnt && !loop_done));
1448 1454
1449 if (loop_done == EVUNLOOP_ONE) 1455 if (loop_done == EVUNLOOP_ONE)
1450 loop_done = EVUNLOOP_CANCEL; 1456 loop_done = EVUNLOOP_CANCEL;
1451} 1457}
1452 1458

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines