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

Comparing libev/ev.c (file contents):
Revision 1.158 by root, Thu Nov 29 17:28:13 2007 UTC vs.
Revision 1.170 by root, Sat Dec 8 22:11:14 2007 UTC

222#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */ 222#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
223/*#define CLEANUP_INTERVAL (MAX_BLOCKTIME * 5.) /* how often to try to free memory and re-check fds */ 223/*#define CLEANUP_INTERVAL (MAX_BLOCKTIME * 5.) /* how often to try to free memory and re-check fds */
224 224
225#if __GNUC__ >= 3 225#if __GNUC__ >= 3
226# define expect(expr,value) __builtin_expect ((expr),(value)) 226# define expect(expr,value) __builtin_expect ((expr),(value))
227# define inline_size static inline /* inline for codesize */
228# if EV_MINIMAL
229# define noinline __attribute__ ((noinline)) 227# define noinline __attribute__ ((noinline))
230# define inline_speed static noinline
231# else
232# define noinline
233# define inline_speed static inline
234# endif
235#else 228#else
236# define expect(expr,value) (expr) 229# define expect(expr,value) (expr)
237# define inline_speed static
238# define inline_size static
239# define noinline 230# define noinline
231# if __STDC_VERSION__ < 199901L
232# define inline
233# endif
240#endif 234#endif
241 235
242#define expect_false(expr) expect ((expr) != 0, 0) 236#define expect_false(expr) expect ((expr) != 0, 0)
243#define expect_true(expr) expect ((expr) != 0, 1) 237#define expect_true(expr) expect ((expr) != 0, 1)
238#define inline_size static inline
239
240#if EV_MINIMAL
241# define inline_speed static noinline
242#else
243# define inline_speed static inline
244#endif
244 245
245#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) 246#define NUMPRI (EV_MAXPRI - EV_MINPRI + 1)
246#define ABSPRI(w) ((w)->priority - EV_MINPRI) 247#define ABSPRI(w) (((W)w)->priority - EV_MINPRI)
247 248
248#define EMPTY0 /* required for microsofts broken pseudo-c compiler */ 249#define EMPTY /* required for microsofts broken pseudo-c compiler */
249#define EMPTY2(a,b) /* used to suppress some warnings */ 250#define EMPTY2(a,b) /* used to suppress some warnings */
250 251
251typedef ev_watcher *W; 252typedef ev_watcher *W;
252typedef ev_watcher_list *WL; 253typedef ev_watcher_list *WL;
253typedef ev_watcher_time *WT; 254typedef ev_watcher_time *WT;
396{ 397{
397 return ev_rt_now; 398 return ev_rt_now;
398} 399}
399#endif 400#endif
400 401
401#define array_roundsize(type,n) (((n) | 4) & ~3) 402int inline_size
403array_nextsize (int elem, int cur, int cnt)
404{
405 int ncur = cur + 1;
406
407 do
408 ncur <<= 1;
409 while (cnt > ncur);
410
411 /* if size > 4096, round to 4096 - 4 * longs to accomodate malloc overhead */
412 if (elem * ncur > 4096)
413 {
414 ncur *= elem;
415 ncur = (ncur + elem + 4095 + sizeof (void *) * 4) & ~4095;
416 ncur = ncur - sizeof (void *) * 4;
417 ncur /= elem;
418 }
419
420 return ncur;
421}
422
423inline_speed void *
424array_realloc (int elem, void *base, int *cur, int cnt)
425{
426 *cur = array_nextsize (elem, *cur, cnt);
427 return ev_realloc (base, elem * *cur);
428}
402 429
403#define array_needsize(type,base,cur,cnt,init) \ 430#define array_needsize(type,base,cur,cnt,init) \
404 if (expect_false ((cnt) > cur)) \ 431 if (expect_false ((cnt) > (cur))) \
405 { \ 432 { \
406 int newcnt = cur; \ 433 int ocur_ = (cur); \
407 do \ 434 (base) = (type *)array_realloc \
408 { \ 435 (sizeof (type), (base), &(cur), (cnt)); \
409 newcnt = array_roundsize (type, newcnt << 1); \ 436 init ((base) + (ocur_), (cur) - ocur_); \
410 } \
411 while ((cnt) > newcnt); \
412 \
413 base = (type *)ev_realloc (base, sizeof (type) * (newcnt));\
414 init (base + cur, newcnt - cur); \
415 cur = newcnt; \
416 } 437 }
417 438
439#if 0
418#define array_slim(type,stem) \ 440#define array_slim(type,stem) \
419 if (stem ## max < array_roundsize (stem ## cnt >> 2)) \ 441 if (stem ## max < array_roundsize (stem ## cnt >> 2)) \
420 { \ 442 { \
421 stem ## max = array_roundsize (stem ## cnt >> 1); \ 443 stem ## max = array_roundsize (stem ## cnt >> 1); \
422 base = (type *)ev_realloc (base, sizeof (type) * (stem ## max));\ 444 base = (type *)ev_realloc (base, sizeof (type) * (stem ## max));\
423 fprintf (stderr, "slimmed down " # stem " to %d\n", stem ## max);/*D*/\ 445 fprintf (stderr, "slimmed down " # stem " to %d\n", stem ## max);/*D*/\
424 } 446 }
447#endif
425 448
426#define array_free(stem, idx) \ 449#define array_free(stem, idx) \
427 ev_free (stem ## s idx); stem ## cnt idx = stem ## max idx = 0; 450 ev_free (stem ## s idx); stem ## cnt idx = stem ## max idx = 0;
428 451
429/*****************************************************************************/ 452/*****************************************************************************/
485} 508}
486 509
487void 510void
488ev_feed_fd_event (EV_P_ int fd, int revents) 511ev_feed_fd_event (EV_P_ int fd, int revents)
489{ 512{
513 if (fd >= 0 && fd < anfdmax)
490 fd_event (EV_A_ fd, revents); 514 fd_event (EV_A_ fd, revents);
491} 515}
492 516
493void inline_size 517void inline_size
494fd_reify (EV_P) 518fd_reify (EV_P)
495{ 519{
764 ev_child *w; 788 ev_child *w;
765 789
766 for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next) 790 for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next)
767 if (w->pid == pid || !w->pid) 791 if (w->pid == pid || !w->pid)
768 { 792 {
769 ev_priority (w) = ev_priority (sw); /* need to do it *now* */ 793 ev_set_priority (w, ev_priority (sw)); /* need to do it *now* */
770 w->rpid = pid; 794 w->rpid = pid;
771 w->rstatus = status; 795 w->rstatus = status;
772 ev_feed_event (EV_A_ (W)w, EV_CHILD); 796 ev_feed_event (EV_A_ (W)w, EV_CHILD);
773 } 797 }
774} 798}
775 799
776#ifndef WCONTINUED 800#ifndef WCONTINUED
886ev_backend (EV_P) 910ev_backend (EV_P)
887{ 911{
888 return backend; 912 return backend;
889} 913}
890 914
915unsigned int
916ev_loop_count (EV_P)
917{
918 return loop_count;
919}
920
891static void noinline 921static void noinline
892loop_init (EV_P_ unsigned int flags) 922loop_init (EV_P_ unsigned int flags)
893{ 923{
894 if (!backend) 924 if (!backend)
895 { 925 {
975#if EV_USE_SELECT 1005#if EV_USE_SELECT
976 if (backend == EVBACKEND_SELECT) select_destroy (EV_A); 1006 if (backend == EVBACKEND_SELECT) select_destroy (EV_A);
977#endif 1007#endif
978 1008
979 for (i = NUMPRI; i--; ) 1009 for (i = NUMPRI; i--; )
1010 {
980 array_free (pending, [i]); 1011 array_free (pending, [i]);
1012#if EV_IDLE_ENABLE
1013 array_free (idle, [i]);
1014#endif
1015 }
981 1016
982 /* have to use the microsoft-never-gets-it-right macro */ 1017 /* have to use the microsoft-never-gets-it-right macro */
983 array_free (fdchange, EMPTY0); 1018 array_free (fdchange, EMPTY);
984 array_free (timer, EMPTY0); 1019 array_free (timer, EMPTY);
985#if EV_PERIODIC_ENABLE 1020#if EV_PERIODIC_ENABLE
986 array_free (periodic, EMPTY0); 1021 array_free (periodic, EMPTY);
987#endif 1022#endif
988 array_free (idle, EMPTY0);
989 array_free (prepare, EMPTY0); 1023 array_free (prepare, EMPTY);
990 array_free (check, EMPTY0); 1024 array_free (check, EMPTY);
991 1025
992 backend = 0; 1026 backend = 0;
993} 1027}
994 1028
995void inline_size infy_fork (EV_P); 1029void inline_size infy_fork (EV_P);
1131 postfork = 1; 1165 postfork = 1;
1132} 1166}
1133 1167
1134/*****************************************************************************/ 1168/*****************************************************************************/
1135 1169
1136int inline_size 1170void
1137any_pending (EV_P) 1171ev_invoke (EV_P_ void *w, int revents)
1138{ 1172{
1139 int pri; 1173 EV_CB_INVOKE ((W)w, revents);
1140
1141 for (pri = NUMPRI; pri--; )
1142 if (pendingcnt [pri])
1143 return 1;
1144
1145 return 0;
1146} 1174}
1147 1175
1148void inline_speed 1176void inline_speed
1149call_pending (EV_P) 1177call_pending (EV_P)
1150{ 1178{
1242 for (i = periodiccnt >> 1; i--; ) 1270 for (i = periodiccnt >> 1; i--; )
1243 downheap ((WT *)periodics, periodiccnt, i); 1271 downheap ((WT *)periodics, periodiccnt, i);
1244} 1272}
1245#endif 1273#endif
1246 1274
1275#if EV_IDLE_ENABLE
1276void inline_size
1277idle_reify (EV_P)
1278{
1279 if (expect_false (idleall))
1280 {
1281 int pri;
1282
1283 for (pri = NUMPRI; pri--; )
1284 {
1285 if (pendingcnt [pri])
1286 break;
1287
1288 if (idlecnt [pri])
1289 {
1290 queue_events (EV_A_ (W *)idles [pri], idlecnt [pri], EV_IDLE);
1291 break;
1292 }
1293 }
1294 }
1295}
1296#endif
1297
1247int inline_size 1298int inline_size
1248time_update_monotonic (EV_P) 1299time_update_monotonic (EV_P)
1249{ 1300{
1250 mn_now = get_clock (); 1301 mn_now = get_clock ();
1251 1302
1342 ? EVUNLOOP_ONE 1393 ? EVUNLOOP_ONE
1343 : EVUNLOOP_CANCEL; 1394 : EVUNLOOP_CANCEL;
1344 1395
1345 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */ 1396 call_pending (EV_A); /* in case we recurse, ensure ordering stays nice and clean */
1346 1397
1347 while (activecnt) 1398 do
1348 { 1399 {
1349#ifndef _WIN32 1400#ifndef _WIN32
1350 if (expect_false (curpid)) /* penalise the forking check even more */ 1401 if (expect_false (curpid)) /* penalise the forking check even more */
1351 if (expect_false (getpid () != curpid)) 1402 if (expect_false (getpid () != curpid))
1352 { 1403 {
1363 queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK); 1414 queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK);
1364 call_pending (EV_A); 1415 call_pending (EV_A);
1365 } 1416 }
1366#endif 1417#endif
1367 1418
1368 /* queue check watchers (and execute them) */ 1419 /* queue prepare watchers (and execute them) */
1369 if (expect_false (preparecnt)) 1420 if (expect_false (preparecnt))
1370 { 1421 {
1371 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); 1422 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE);
1372 call_pending (EV_A); 1423 call_pending (EV_A);
1373 } 1424 }
1374 1425
1426 if (expect_false (!activecnt))
1427 break;
1428
1375 /* we might have forked, so reify kernel state if necessary */ 1429 /* we might have forked, so reify kernel state if necessary */
1376 if (expect_false (postfork)) 1430 if (expect_false (postfork))
1377 loop_fork (EV_A); 1431 loop_fork (EV_A);
1378 1432
1379 /* update fd-related kernel structures */ 1433 /* update fd-related kernel structures */
1381 1435
1382 /* calculate blocking time */ 1436 /* calculate blocking time */
1383 { 1437 {
1384 ev_tstamp block; 1438 ev_tstamp block;
1385 1439
1386 if (flags & EVLOOP_NONBLOCK || idlecnt) 1440 if (expect_false (flags & EVLOOP_NONBLOCK || idleall || !activecnt))
1387 block = 0.; /* do not block at all */ 1441 block = 0.; /* do not block at all */
1388 else 1442 else
1389 { 1443 {
1390 /* update time to cancel out callback processing overhead */ 1444 /* update time to cancel out callback processing overhead */
1391#if EV_USE_MONOTONIC 1445#if EV_USE_MONOTONIC
1415#endif 1469#endif
1416 1470
1417 if (expect_false (block < 0.)) block = 0.; 1471 if (expect_false (block < 0.)) block = 0.;
1418 } 1472 }
1419 1473
1474 ++loop_count;
1420 backend_poll (EV_A_ block); 1475 backend_poll (EV_A_ block);
1421 } 1476 }
1422 1477
1423 /* update ev_rt_now, do magic */ 1478 /* update ev_rt_now, do magic */
1424 time_update (EV_A); 1479 time_update (EV_A);
1427 timers_reify (EV_A); /* relative timers called last */ 1482 timers_reify (EV_A); /* relative timers called last */
1428#if EV_PERIODIC_ENABLE 1483#if EV_PERIODIC_ENABLE
1429 periodics_reify (EV_A); /* absolute timers called first */ 1484 periodics_reify (EV_A); /* absolute timers called first */
1430#endif 1485#endif
1431 1486
1487#if EV_IDLE_ENABLE
1432 /* queue idle watchers unless other events are pending */ 1488 /* queue idle watchers unless other events are pending */
1433 if (idlecnt && !any_pending (EV_A)) 1489 idle_reify (EV_A);
1434 queue_events (EV_A_ (W *)idles, idlecnt, EV_IDLE); 1490#endif
1435 1491
1436 /* queue check watchers, to be executed first */ 1492 /* queue check watchers, to be executed first */
1437 if (expect_false (checkcnt)) 1493 if (expect_false (checkcnt))
1438 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); 1494 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
1439 1495
1440 call_pending (EV_A); 1496 call_pending (EV_A);
1441 1497
1442 if (expect_false (loop_done))
1443 break;
1444 } 1498 }
1499 while (expect_true (activecnt && !loop_done));
1445 1500
1446 if (loop_done == EVUNLOOP_ONE) 1501 if (loop_done == EVUNLOOP_ONE)
1447 loop_done = EVUNLOOP_CANCEL; 1502 loop_done = EVUNLOOP_CANCEL;
1448} 1503}
1449 1504
1476 head = &(*head)->next; 1531 head = &(*head)->next;
1477 } 1532 }
1478} 1533}
1479 1534
1480void inline_speed 1535void inline_speed
1481ev_clear_pending (EV_P_ W w) 1536clear_pending (EV_P_ W w)
1482{ 1537{
1483 if (w->pending) 1538 if (w->pending)
1484 { 1539 {
1485 pendings [ABSPRI (w)][w->pending - 1].w = 0; 1540 pendings [ABSPRI (w)][w->pending - 1].w = 0;
1486 w->pending = 0; 1541 w->pending = 0;
1487 } 1542 }
1488} 1543}
1489 1544
1545int
1546ev_clear_pending (EV_P_ void *w)
1547{
1548 W w_ = (W)w;
1549 int pending = w_->pending;
1550
1551 if (!pending)
1552 return 0;
1553
1554 w_->pending = 0;
1555 ANPENDING *p = pendings [ABSPRI (w_)] + pending - 1;
1556 p->w = 0;
1557
1558 return p->events;
1559}
1560
1561void inline_size
1562pri_adjust (EV_P_ W w)
1563{
1564 int pri = w->priority;
1565 pri = pri < EV_MINPRI ? EV_MINPRI : pri;
1566 pri = pri > EV_MAXPRI ? EV_MAXPRI : pri;
1567 w->priority = pri;
1568}
1569
1490void inline_speed 1570void inline_speed
1491ev_start (EV_P_ W w, int active) 1571ev_start (EV_P_ W w, int active)
1492{ 1572{
1493 if (w->priority < EV_MINPRI) w->priority = EV_MINPRI; 1573 pri_adjust (EV_A_ w);
1494 if (w->priority > EV_MAXPRI) w->priority = EV_MAXPRI;
1495
1496 w->active = active; 1574 w->active = active;
1497 ev_ref (EV_A); 1575 ev_ref (EV_A);
1498} 1576}
1499 1577
1500void inline_size 1578void inline_size
1524} 1602}
1525 1603
1526void 1604void
1527ev_io_stop (EV_P_ ev_io *w) 1605ev_io_stop (EV_P_ ev_io *w)
1528{ 1606{
1529 ev_clear_pending (EV_A_ (W)w); 1607 clear_pending (EV_A_ (W)w);
1530 if (expect_false (!ev_is_active (w))) 1608 if (expect_false (!ev_is_active (w)))
1531 return; 1609 return;
1532 1610
1533 assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); 1611 assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
1534 1612
1557} 1635}
1558 1636
1559void 1637void
1560ev_timer_stop (EV_P_ ev_timer *w) 1638ev_timer_stop (EV_P_ ev_timer *w)
1561{ 1639{
1562 ev_clear_pending (EV_A_ (W)w); 1640 clear_pending (EV_A_ (W)w);
1563 if (expect_false (!ev_is_active (w))) 1641 if (expect_false (!ev_is_active (w)))
1564 return; 1642 return;
1565 1643
1566 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); 1644 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));
1567 1645
1625} 1703}
1626 1704
1627void 1705void
1628ev_periodic_stop (EV_P_ ev_periodic *w) 1706ev_periodic_stop (EV_P_ ev_periodic *w)
1629{ 1707{
1630 ev_clear_pending (EV_A_ (W)w); 1708 clear_pending (EV_A_ (W)w);
1631 if (expect_false (!ev_is_active (w))) 1709 if (expect_false (!ev_is_active (w)))
1632 return; 1710 return;
1633 1711
1634 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); 1712 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));
1635 1713
1689} 1767}
1690 1768
1691void 1769void
1692ev_signal_stop (EV_P_ ev_signal *w) 1770ev_signal_stop (EV_P_ ev_signal *w)
1693{ 1771{
1694 ev_clear_pending (EV_A_ (W)w); 1772 clear_pending (EV_A_ (W)w);
1695 if (expect_false (!ev_is_active (w))) 1773 if (expect_false (!ev_is_active (w)))
1696 return; 1774 return;
1697 1775
1698 wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w); 1776 wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w);
1699 ev_stop (EV_A_ (W)w); 1777 ev_stop (EV_A_ (W)w);
1716} 1794}
1717 1795
1718void 1796void
1719ev_child_stop (EV_P_ ev_child *w) 1797ev_child_stop (EV_P_ ev_child *w)
1720{ 1798{
1721 ev_clear_pending (EV_A_ (W)w); 1799 clear_pending (EV_A_ (W)w);
1722 if (expect_false (!ev_is_active (w))) 1800 if (expect_false (!ev_is_active (w)))
1723 return; 1801 return;
1724 1802
1725 wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); 1803 wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w);
1726 ev_stop (EV_A_ (W)w); 1804 ev_stop (EV_A_ (W)w);
1962} 2040}
1963 2041
1964void 2042void
1965ev_stat_stop (EV_P_ ev_stat *w) 2043ev_stat_stop (EV_P_ ev_stat *w)
1966{ 2044{
1967 ev_clear_pending (EV_A_ (W)w); 2045 clear_pending (EV_A_ (W)w);
1968 if (expect_false (!ev_is_active (w))) 2046 if (expect_false (!ev_is_active (w)))
1969 return; 2047 return;
1970 2048
1971#if EV_USE_INOTIFY 2049#if EV_USE_INOTIFY
1972 infy_del (EV_A_ w); 2050 infy_del (EV_A_ w);
1975 2053
1976 ev_stop (EV_A_ (W)w); 2054 ev_stop (EV_A_ (W)w);
1977} 2055}
1978#endif 2056#endif
1979 2057
2058#if EV_IDLE_ENABLE
1980void 2059void
1981ev_idle_start (EV_P_ ev_idle *w) 2060ev_idle_start (EV_P_ ev_idle *w)
1982{ 2061{
1983 if (expect_false (ev_is_active (w))) 2062 if (expect_false (ev_is_active (w)))
1984 return; 2063 return;
1985 2064
2065 pri_adjust (EV_A_ (W)w);
2066
2067 {
2068 int active = ++idlecnt [ABSPRI (w)];
2069
2070 ++idleall;
1986 ev_start (EV_A_ (W)w, ++idlecnt); 2071 ev_start (EV_A_ (W)w, active);
2072
1987 array_needsize (ev_idle *, idles, idlemax, idlecnt, EMPTY2); 2073 array_needsize (ev_idle *, idles [ABSPRI (w)], idlemax [ABSPRI (w)], active, EMPTY2);
1988 idles [idlecnt - 1] = w; 2074 idles [ABSPRI (w)][active - 1] = w;
2075 }
1989} 2076}
1990 2077
1991void 2078void
1992ev_idle_stop (EV_P_ ev_idle *w) 2079ev_idle_stop (EV_P_ ev_idle *w)
1993{ 2080{
1994 ev_clear_pending (EV_A_ (W)w); 2081 clear_pending (EV_A_ (W)w);
1995 if (expect_false (!ev_is_active (w))) 2082 if (expect_false (!ev_is_active (w)))
1996 return; 2083 return;
1997 2084
1998 { 2085 {
1999 int active = ((W)w)->active; 2086 int active = ((W)w)->active;
2000 idles [active - 1] = idles [--idlecnt]; 2087
2088 idles [ABSPRI (w)][active - 1] = idles [ABSPRI (w)][--idlecnt [ABSPRI (w)]];
2001 ((W)idles [active - 1])->active = active; 2089 ((W)idles [ABSPRI (w)][active - 1])->active = active;
2090
2091 ev_stop (EV_A_ (W)w);
2092 --idleall;
2002 } 2093 }
2003
2004 ev_stop (EV_A_ (W)w);
2005} 2094}
2095#endif
2006 2096
2007void 2097void
2008ev_prepare_start (EV_P_ ev_prepare *w) 2098ev_prepare_start (EV_P_ ev_prepare *w)
2009{ 2099{
2010 if (expect_false (ev_is_active (w))) 2100 if (expect_false (ev_is_active (w)))
2016} 2106}
2017 2107
2018void 2108void
2019ev_prepare_stop (EV_P_ ev_prepare *w) 2109ev_prepare_stop (EV_P_ ev_prepare *w)
2020{ 2110{
2021 ev_clear_pending (EV_A_ (W)w); 2111 clear_pending (EV_A_ (W)w);
2022 if (expect_false (!ev_is_active (w))) 2112 if (expect_false (!ev_is_active (w)))
2023 return; 2113 return;
2024 2114
2025 { 2115 {
2026 int active = ((W)w)->active; 2116 int active = ((W)w)->active;
2043} 2133}
2044 2134
2045void 2135void
2046ev_check_stop (EV_P_ ev_check *w) 2136ev_check_stop (EV_P_ ev_check *w)
2047{ 2137{
2048 ev_clear_pending (EV_A_ (W)w); 2138 clear_pending (EV_A_ (W)w);
2049 if (expect_false (!ev_is_active (w))) 2139 if (expect_false (!ev_is_active (w)))
2050 return; 2140 return;
2051 2141
2052 { 2142 {
2053 int active = ((W)w)->active; 2143 int active = ((W)w)->active;
2095} 2185}
2096 2186
2097void 2187void
2098ev_embed_stop (EV_P_ ev_embed *w) 2188ev_embed_stop (EV_P_ ev_embed *w)
2099{ 2189{
2100 ev_clear_pending (EV_A_ (W)w); 2190 clear_pending (EV_A_ (W)w);
2101 if (expect_false (!ev_is_active (w))) 2191 if (expect_false (!ev_is_active (w)))
2102 return; 2192 return;
2103 2193
2104 ev_io_stop (EV_A_ &w->io); 2194 ev_io_stop (EV_A_ &w->io);
2105 2195
2120} 2210}
2121 2211
2122void 2212void
2123ev_fork_stop (EV_P_ ev_fork *w) 2213ev_fork_stop (EV_P_ ev_fork *w)
2124{ 2214{
2125 ev_clear_pending (EV_A_ (W)w); 2215 clear_pending (EV_A_ (W)w);
2126 if (expect_false (!ev_is_active (w))) 2216 if (expect_false (!ev_is_active (w)))
2127 return; 2217 return;
2128 2218
2129 { 2219 {
2130 int active = ((W)w)->active; 2220 int active = ((W)w)->active;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines