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

Comparing libev/ev.c (file contents):
Revision 1.330 by root, Tue Mar 9 08:46:17 2010 UTC vs.
Revision 1.337 by root, Wed Mar 10 09:18:24 2010 UTC

184# define WIN32_LEAN_AND_MEAN 184# define WIN32_LEAN_AND_MEAN
185# include <windows.h> 185# include <windows.h>
186# ifndef EV_SELECT_IS_WINSOCKET 186# ifndef EV_SELECT_IS_WINSOCKET
187# define EV_SELECT_IS_WINSOCKET 1 187# define EV_SELECT_IS_WINSOCKET 1
188# endif 188# endif
189# undef EV_AVOID_STDIO
189#endif 190#endif
190 191
191/* this block tries to deduce configuration from header-defined symbols and defaults */ 192/* this block tries to deduce configuration from header-defined symbols and defaults */
192 193
193/* try to deduce the maximum number of signals on this platform */ 194/* try to deduce the maximum number of signals on this platform */
206#elif defined (MAXSIG) 207#elif defined (MAXSIG)
207# define EV_NSIG (MAXSIG+1) 208# define EV_NSIG (MAXSIG+1)
208#elif defined (MAX_SIG) 209#elif defined (MAX_SIG)
209# define EV_NSIG (MAX_SIG+1) 210# define EV_NSIG (MAX_SIG+1)
210#elif defined (SIGARRAYSIZE) 211#elif defined (SIGARRAYSIZE)
211# define EV_NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */ 212# define EV_NSIG (SIGARRAYSIZE) /* Assume ary[SIGARRAYSIZE] */
212#elif defined (_sys_nsig) 213#elif defined (_sys_nsig)
213# define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ 214# define EV_NSIG (_sys_nsig) /* Solaris 2.5 */
214#else 215#else
215# error "unable to find value for NSIG, please report" 216# error "unable to find value for NSIG, please report"
216/* to make it compile regardless, just remove the above line */ 217/* to make it compile regardless, just remove the above line, */
218/* but consider reporting it, too! :) */
217# define EV_NSIG 65 219# define EV_NSIG 65
218#endif 220#endif
219 221
220#ifndef EV_USE_CLOCK_SYSCALL 222#ifndef EV_USE_CLOCK_SYSCALL
221# if __linux && __GLIBC__ >= 2 223# if __linux && __GLIBC__ >= 2
524# include "ev_win32.c" 526# include "ev_win32.c"
525#endif 527#endif
526 528
527/*****************************************************************************/ 529/*****************************************************************************/
528 530
531#if EV_AVOID_STDIO
532static void noinline
533ev_printerr (const char *msg)
534{
535 write (STDERR_FILENO, msg, strlen (msg));
536}
537#endif
538
529static void (*syserr_cb)(const char *msg); 539static void (*syserr_cb)(const char *msg);
530 540
531void 541void
532ev_set_syserr_cb (void (*cb)(const char *msg)) 542ev_set_syserr_cb (void (*cb)(const char *msg))
533{ 543{
543 if (syserr_cb) 553 if (syserr_cb)
544 syserr_cb (msg); 554 syserr_cb (msg);
545 else 555 else
546 { 556 {
547#if EV_AVOID_STDIO 557#if EV_AVOID_STDIO
548 write (STDERR_FILENO, msg, strlen (msg));
549 write (STDERR_FILENO, ": ", 2);
550 msg = strerror (errno); 558 const char *err = strerror (errno);
551 write (STDERR_FILENO, msg, strlen (msg)); 559
552 write (STDERR_FILENO, "\n", 1); 560 ev_printerr (msg);
561 ev_printerr (": ");
562 ev_printerr (err);
563 ev_printerr ("\n");
553#else 564#else
554 perror (msg); 565 perror (msg);
555#endif 566#endif
556 abort (); 567 abort ();
557 } 568 }
558} 569}
559 570
560static void * 571static void *
561ev_realloc_emul (void *ptr, long size) 572ev_realloc_emul (void *ptr, long size)
562{ 573{
574#if __GLIBC__
575 return realloc (ptr, size);
576#else
563 /* some systems, notably openbsd and darwin, fail to properly 577 /* some systems, notably openbsd and darwin, fail to properly
564 * implement realloc (x, 0) (as required by both ansi c-98 and 578 * implement realloc (x, 0) (as required by both ansi c-89 and
565 * the single unix specification, so work around them here. 579 * the single unix specification, so work around them here.
566 */ 580 */
567 581
568 if (size) 582 if (size)
569 return realloc (ptr, size); 583 return realloc (ptr, size);
570 584
571 free (ptr); 585 free (ptr);
572 return 0; 586 return 0;
587#endif
573} 588}
574 589
575static void *(*alloc)(void *ptr, long size) = ev_realloc_emul; 590static void *(*alloc)(void *ptr, long size) = ev_realloc_emul;
576 591
577void 592void
586 ptr = alloc (ptr, size); 601 ptr = alloc (ptr, size);
587 602
588 if (!ptr && size) 603 if (!ptr && size)
589 { 604 {
590#if EV_AVOID_STDIO 605#if EV_AVOID_STDIO
591 write (STDERR_FILENO, "libev: memory allocation failed, aborting.", 606 ev_printerr ("libev: memory allocation failed, aborting.\n");
592 sizeof ("libev: memory allocation failed, aborting.") - 1);
593#else 607#else
594 fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size); 608 fprintf (stderr, "libev: cannot allocate %ld bytes, aborting.", size);
595#endif 609#endif
596 abort (); 610 abort ();
597 } 611 }
877} 891}
878 892
879/*****************************************************************************/ 893/*****************************************************************************/
880 894
881inline_speed void 895inline_speed void
882fd_event_nc (EV_P_ int fd, int revents) 896fd_event_nocheck (EV_P_ int fd, int revents)
883{ 897{
884 ANFD *anfd = anfds + fd; 898 ANFD *anfd = anfds + fd;
885 ev_io *w; 899 ev_io *w;
886 900
887 for (w = (ev_io *)anfd->head; w; w = (ev_io *)((WL)w)->next) 901 for (w = (ev_io *)anfd->head; w; w = (ev_io *)((WL)w)->next)
899fd_event (EV_P_ int fd, int revents) 913fd_event (EV_P_ int fd, int revents)
900{ 914{
901 ANFD *anfd = anfds + fd; 915 ANFD *anfd = anfds + fd;
902 916
903 if (expect_true (!anfd->reify)) 917 if (expect_true (!anfd->reify))
904 fd_event_nc (EV_A_ fd, revents); 918 fd_event_nocheck (EV_A_ fd, revents);
905} 919}
906 920
907void 921void
908ev_feed_fd_event (EV_P_ int fd, int revents) 922ev_feed_fd_event (EV_P_ int fd, int revents)
909{ 923{
910 if (fd >= 0 && fd < anfdmax) 924 if (fd >= 0 && fd < anfdmax)
911 fd_event_nc (EV_A_ fd, revents); 925 fd_event_nocheck (EV_A_ fd, revents);
912} 926}
913 927
914/* make sure the external fd watch events are in-sync */ 928/* make sure the external fd watch events are in-sync */
915/* with the kernel/libev internal state */ 929/* with the kernel/libev internal state */
916inline_size void 930inline_size void
979 ev_io_stop (EV_A_ w); 993 ev_io_stop (EV_A_ w);
980 ev_feed_event (EV_A_ (W)w, EV_ERROR | EV_READ | EV_WRITE); 994 ev_feed_event (EV_A_ (W)w, EV_ERROR | EV_READ | EV_WRITE);
981 } 995 }
982} 996}
983 997
984/* check whether the given fd is atcually valid, for error recovery */ 998/* check whether the given fd is actually valid, for error recovery */
985inline_size int 999inline_size int
986fd_valid (int fd) 1000fd_valid (int fd)
987{ 1001{
988#ifdef _WIN32 1002#ifdef _WIN32
989 return EV_FD_TO_WIN32_HANDLE (fd) != -1; 1003 return EV_FD_TO_WIN32_HANDLE (fd) != -1;
1029 { 1043 {
1030 anfds [fd].events = 0; 1044 anfds [fd].events = 0;
1031 anfds [fd].emask = 0; 1045 anfds [fd].emask = 0;
1032 fd_change (EV_A_ fd, EV__IOFDSET | EV_ANFD_REIFY); 1046 fd_change (EV_A_ fd, EV__IOFDSET | EV_ANFD_REIFY);
1033 } 1047 }
1048}
1049
1050/* used to prepare libev internal fd's */
1051/* this is not fork-safe */
1052inline_speed void
1053fd_intern (int fd)
1054{
1055#ifdef _WIN32
1056 unsigned long arg = 1;
1057 ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg);
1058#else
1059 fcntl (fd, F_SETFD, FD_CLOEXEC);
1060 fcntl (fd, F_SETFL, O_NONBLOCK);
1061#endif
1034} 1062}
1035 1063
1036/*****************************************************************************/ 1064/*****************************************************************************/
1037 1065
1038/* 1066/*
1192 1220
1193static ANSIG signals [EV_NSIG - 1]; 1221static ANSIG signals [EV_NSIG - 1];
1194 1222
1195/*****************************************************************************/ 1223/*****************************************************************************/
1196 1224
1197/* used to prepare libev internal fd's */ 1225#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
1198/* this is not fork-safe */
1199inline_speed void
1200fd_intern (int fd)
1201{
1202#ifdef _WIN32
1203 unsigned long arg = 1;
1204 ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg);
1205#else
1206 fcntl (fd, F_SETFD, FD_CLOEXEC);
1207 fcntl (fd, F_SETFL, O_NONBLOCK);
1208#endif
1209}
1210 1226
1211static void noinline 1227static void noinline
1212evpipe_init (EV_P) 1228evpipe_init (EV_P)
1213{ 1229{
1214 if (!ev_is_active (&pipe_w)) 1230 if (!ev_is_active (&pipe_w))
1215 { 1231 {
1216#if EV_USE_EVENTFD 1232# if EV_USE_EVENTFD
1217 evfd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC); 1233 evfd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC);
1218 if (evfd < 0 && errno == EINVAL) 1234 if (evfd < 0 && errno == EINVAL)
1219 evfd = eventfd (0, 0); 1235 evfd = eventfd (0, 0);
1220 1236
1221 if (evfd >= 0) 1237 if (evfd >= 0)
1223 evpipe [0] = -1; 1239 evpipe [0] = -1;
1224 fd_intern (evfd); /* doing it twice doesn't hurt */ 1240 fd_intern (evfd); /* doing it twice doesn't hurt */
1225 ev_io_set (&pipe_w, evfd, EV_READ); 1241 ev_io_set (&pipe_w, evfd, EV_READ);
1226 } 1242 }
1227 else 1243 else
1228#endif 1244# endif
1229 { 1245 {
1230 while (pipe (evpipe)) 1246 while (pipe (evpipe))
1231 ev_syserr ("(libev) error creating signal/async pipe"); 1247 ev_syserr ("(libev) error creating signal/async pipe");
1232 1248
1233 fd_intern (evpipe [0]); 1249 fd_intern (evpipe [0]);
1244evpipe_write (EV_P_ EV_ATOMIC_T *flag) 1260evpipe_write (EV_P_ EV_ATOMIC_T *flag)
1245{ 1261{
1246 if (!*flag) 1262 if (!*flag)
1247 { 1263 {
1248 int old_errno = errno; /* save errno because write might clobber it */ 1264 int old_errno = errno; /* save errno because write might clobber it */
1265 char dummy;
1249 1266
1250 *flag = 1; 1267 *flag = 1;
1251 1268
1252#if EV_USE_EVENTFD 1269#if EV_USE_EVENTFD
1253 if (evfd >= 0) 1270 if (evfd >= 0)
1255 uint64_t counter = 1; 1272 uint64_t counter = 1;
1256 write (evfd, &counter, sizeof (uint64_t)); 1273 write (evfd, &counter, sizeof (uint64_t));
1257 } 1274 }
1258 else 1275 else
1259#endif 1276#endif
1260 write (evpipe [1], &old_errno, 1); 1277 write (evpipe [1], &dummy, 1);
1261 1278
1262 errno = old_errno; 1279 errno = old_errno;
1263 } 1280 }
1264} 1281}
1265 1282
1366 break; 1383 break;
1367 } 1384 }
1368} 1385}
1369#endif 1386#endif
1370 1387
1388#endif
1389
1371/*****************************************************************************/ 1390/*****************************************************************************/
1372 1391
1392#if EV_CHILD_ENABLE
1373static WL childs [EV_PID_HASHSIZE]; 1393static WL childs [EV_PID_HASHSIZE];
1374
1375#ifndef _WIN32
1376 1394
1377static ev_signal childev; 1395static ev_signal childev;
1378 1396
1379#ifndef WIFCONTINUED 1397#ifndef WIFCONTINUED
1380# define WIFCONTINUED(status) 0 1398# define WIFCONTINUED(status) 0
1649 if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags); 1667 if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags);
1650#endif 1668#endif
1651 1669
1652 ev_prepare_init (&pending_w, pendingcb); 1670 ev_prepare_init (&pending_w, pendingcb);
1653 1671
1672#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
1654 ev_init (&pipe_w, pipecb); 1673 ev_init (&pipe_w, pipecb);
1655 ev_set_priority (&pipe_w, EV_MAXPRI); 1674 ev_set_priority (&pipe_w, EV_MAXPRI);
1675#endif
1656 } 1676 }
1657} 1677}
1658 1678
1659/* free up a loop structure */ 1679/* free up a loop structure */
1660static void noinline 1680static void noinline
1778 { 1798 {
1779 EV_WIN32_CLOSE_FD (evpipe [0]); 1799 EV_WIN32_CLOSE_FD (evpipe [0]);
1780 EV_WIN32_CLOSE_FD (evpipe [1]); 1800 EV_WIN32_CLOSE_FD (evpipe [1]);
1781 } 1801 }
1782 1802
1803#if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE
1783 evpipe_init (EV_A); 1804 evpipe_init (EV_A);
1784 /* now iterate over everything, in case we missed something */ 1805 /* now iterate over everything, in case we missed something */
1785 pipecb (EV_A_ &pipe_w, EV_READ); 1806 pipecb (EV_A_ &pipe_w, EV_READ);
1807#endif
1786 } 1808 }
1787 1809
1788 postfork = 0; 1810 postfork = 0;
1789} 1811}
1790 1812
1903#if EV_ASYNC_ENABLE 1925#if EV_ASYNC_ENABLE
1904 assert (asyncmax >= asynccnt); 1926 assert (asyncmax >= asynccnt);
1905 array_verify (EV_A_ (W *)asyncs, asynccnt); 1927 array_verify (EV_A_ (W *)asyncs, asynccnt);
1906#endif 1928#endif
1907 1929
1930#if EV_PREPARE_ENABLE
1908 assert (preparemax >= preparecnt); 1931 assert (preparemax >= preparecnt);
1909 array_verify (EV_A_ (W *)prepares, preparecnt); 1932 array_verify (EV_A_ (W *)prepares, preparecnt);
1933#endif
1910 1934
1935#if EV_CHECK_ENABLE
1911 assert (checkmax >= checkcnt); 1936 assert (checkmax >= checkcnt);
1912 array_verify (EV_A_ (W *)checks, checkcnt); 1937 array_verify (EV_A_ (W *)checks, checkcnt);
1938#endif
1913 1939
1914# if 0 1940# if 0
1941#if EV_CHILD_ENABLE
1915 for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next) 1942 for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next)
1916 for (signum = EV_NSIG; signum--; ) if (signals [signum].pending) 1943 for (signum = EV_NSIG; signum--; ) if (signals [signum].pending)
1944#endif
1917# endif 1945# endif
1918#endif 1946#endif
1919} 1947}
1920#endif 1948#endif
1921 1949
1937 1965
1938 loop_init (EV_A_ flags); 1966 loop_init (EV_A_ flags);
1939 1967
1940 if (ev_backend (EV_A)) 1968 if (ev_backend (EV_A))
1941 { 1969 {
1942#ifndef _WIN32 1970#if EV_CHILD_ENABLE
1943 ev_signal_init (&childev, childcb, SIGCHLD); 1971 ev_signal_init (&childev, childcb, SIGCHLD);
1944 ev_set_priority (&childev, EV_MAXPRI); 1972 ev_set_priority (&childev, EV_MAXPRI);
1945 ev_signal_start (EV_A_ &childev); 1973 ev_signal_start (EV_A_ &childev);
1946 ev_unref (EV_A); /* child watcher should not keep loop alive */ 1974 ev_unref (EV_A); /* child watcher should not keep loop alive */
1947#endif 1975#endif
1960 EV_P = ev_default_loop_ptr; 1988 EV_P = ev_default_loop_ptr;
1961#endif 1989#endif
1962 1990
1963 ev_default_loop_ptr = 0; 1991 ev_default_loop_ptr = 0;
1964 1992
1965#ifndef _WIN32 1993#if EV_CHILD_ENABLE
1966 ev_ref (EV_A); /* child watcher */ 1994 ev_ref (EV_A); /* child watcher */
1967 ev_signal_stop (EV_A_ &childev); 1995 ev_signal_stop (EV_A_ &childev);
1968#endif 1996#endif
1969 1997
1970 loop_destroy (EV_A); 1998 loop_destroy (EV_A);
2282 queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK); 2310 queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK);
2283 EV_INVOKE_PENDING; 2311 EV_INVOKE_PENDING;
2284 } 2312 }
2285#endif 2313#endif
2286 2314
2315#if EV_PREPARE_ENABLE
2287 /* queue prepare watchers (and execute them) */ 2316 /* queue prepare watchers (and execute them) */
2288 if (expect_false (preparecnt)) 2317 if (expect_false (preparecnt))
2289 { 2318 {
2290 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); 2319 queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE);
2291 EV_INVOKE_PENDING; 2320 EV_INVOKE_PENDING;
2292 } 2321 }
2322#endif
2293 2323
2294 if (expect_false (loop_done)) 2324 if (expect_false (loop_done))
2295 break; 2325 break;
2296 2326
2297 /* we might have forked, so reify kernel state if necessary */ 2327 /* we might have forked, so reify kernel state if necessary */
2370#if EV_IDLE_ENABLE 2400#if EV_IDLE_ENABLE
2371 /* queue idle watchers unless other events are pending */ 2401 /* queue idle watchers unless other events are pending */
2372 idle_reify (EV_A); 2402 idle_reify (EV_A);
2373#endif 2403#endif
2374 2404
2405#if EV_CHECK_ENABLE
2375 /* queue check watchers, to be executed first */ 2406 /* queue check watchers, to be executed first */
2376 if (expect_false (checkcnt)) 2407 if (expect_false (checkcnt))
2377 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); 2408 queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK);
2409#endif
2378 2410
2379 EV_INVOKE_PENDING; 2411 EV_INVOKE_PENDING;
2380 } 2412 }
2381 while (expect_true ( 2413 while (expect_true (
2382 activecnt 2414 activecnt
2712 2744
2713#ifndef SA_RESTART 2745#ifndef SA_RESTART
2714# define SA_RESTART 0 2746# define SA_RESTART 0
2715#endif 2747#endif
2716 2748
2749#if EV_SIGNAL_ENABLE
2750
2717void noinline 2751void noinline
2718ev_signal_start (EV_P_ ev_signal *w) 2752ev_signal_start (EV_P_ ev_signal *w)
2719{ 2753{
2720 if (expect_false (ev_is_active (w))) 2754 if (expect_false (ev_is_active (w)))
2721 return; 2755 return;
2827 } 2861 }
2828 2862
2829 EV_FREQUENT_CHECK; 2863 EV_FREQUENT_CHECK;
2830} 2864}
2831 2865
2866#endif
2867
2868#if EV_CHILD_ENABLE
2869
2832void 2870void
2833ev_child_start (EV_P_ ev_child *w) 2871ev_child_start (EV_P_ ev_child *w)
2834{ 2872{
2835#if EV_MULTIPLICITY 2873#if EV_MULTIPLICITY
2836 assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr)); 2874 assert (("libev: child watchers are only supported in the default loop", loop == ev_default_loop_ptr));
2858 wlist_del (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); 2896 wlist_del (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w);
2859 ev_stop (EV_A_ (W)w); 2897 ev_stop (EV_A_ (W)w);
2860 2898
2861 EV_FREQUENT_CHECK; 2899 EV_FREQUENT_CHECK;
2862} 2900}
2901
2902#endif
2863 2903
2864#if EV_STAT_ENABLE 2904#if EV_STAT_ENABLE
2865 2905
2866# ifdef _WIN32 2906# ifdef _WIN32
2867# undef lstat 2907# undef lstat
3288 3328
3289 EV_FREQUENT_CHECK; 3329 EV_FREQUENT_CHECK;
3290} 3330}
3291#endif 3331#endif
3292 3332
3333#if EV_PREPARE_ENABLE
3293void 3334void
3294ev_prepare_start (EV_P_ ev_prepare *w) 3335ev_prepare_start (EV_P_ ev_prepare *w)
3295{ 3336{
3296 if (expect_false (ev_is_active (w))) 3337 if (expect_false (ev_is_active (w)))
3297 return; 3338 return;
3323 3364
3324 ev_stop (EV_A_ (W)w); 3365 ev_stop (EV_A_ (W)w);
3325 3366
3326 EV_FREQUENT_CHECK; 3367 EV_FREQUENT_CHECK;
3327} 3368}
3369#endif
3328 3370
3371#if EV_CHECK_ENABLE
3329void 3372void
3330ev_check_start (EV_P_ ev_check *w) 3373ev_check_start (EV_P_ ev_check *w)
3331{ 3374{
3332 if (expect_false (ev_is_active (w))) 3375 if (expect_false (ev_is_active (w)))
3333 return; 3376 return;
3359 3402
3360 ev_stop (EV_A_ (W)w); 3403 ev_stop (EV_A_ (W)w);
3361 3404
3362 EV_FREQUENT_CHECK; 3405 EV_FREQUENT_CHECK;
3363} 3406}
3407#endif
3364 3408
3365#if EV_EMBED_ENABLE 3409#if EV_EMBED_ENABLE
3366void noinline 3410void noinline
3367ev_embed_sweep (EV_P_ ev_embed *w) 3411ev_embed_sweep (EV_P_ ev_embed *w)
3368{ 3412{
3697 if (types & EV_ASYNC) 3741 if (types & EV_ASYNC)
3698 for (i = asynccnt; i--; ) 3742 for (i = asynccnt; i--; )
3699 cb (EV_A_ EV_ASYNC, asyncs [i]); 3743 cb (EV_A_ EV_ASYNC, asyncs [i]);
3700#endif 3744#endif
3701 3745
3746#if EV_PREPARE_ENABLE
3702 if (types & EV_PREPARE) 3747 if (types & EV_PREPARE)
3703 for (i = preparecnt; i--; ) 3748 for (i = preparecnt; i--; )
3704#if EV_EMBED_ENABLE 3749# if EV_EMBED_ENABLE
3705 if (ev_cb (prepares [i]) != embed_prepare_cb) 3750 if (ev_cb (prepares [i]) != embed_prepare_cb)
3706#endif 3751# endif
3707 cb (EV_A_ EV_PREPARE, prepares [i]); 3752 cb (EV_A_ EV_PREPARE, prepares [i]);
3753#endif
3708 3754
3755#if EV_CHECK_ENABLE
3709 if (types & EV_CHECK) 3756 if (types & EV_CHECK)
3710 for (i = checkcnt; i--; ) 3757 for (i = checkcnt; i--; )
3711 cb (EV_A_ EV_CHECK, checks [i]); 3758 cb (EV_A_ EV_CHECK, checks [i]);
3759#endif
3712 3760
3761#if EV_SIGNAL_ENABLE
3713 if (types & EV_SIGNAL) 3762 if (types & EV_SIGNAL)
3714 for (i = 0; i < EV_NSIG - 1; ++i) 3763 for (i = 0; i < EV_NSIG - 1; ++i)
3715 for (wl = signals [i].head; wl; ) 3764 for (wl = signals [i].head; wl; )
3716 { 3765 {
3717 wn = wl->next; 3766 wn = wl->next;
3718 cb (EV_A_ EV_SIGNAL, wl); 3767 cb (EV_A_ EV_SIGNAL, wl);
3719 wl = wn; 3768 wl = wn;
3720 } 3769 }
3770#endif
3721 3771
3772#if EV_CHILD_ENABLE
3722 if (types & EV_CHILD) 3773 if (types & EV_CHILD)
3723 for (i = EV_PID_HASHSIZE; i--; ) 3774 for (i = EV_PID_HASHSIZE; i--; )
3724 for (wl = childs [i]; wl; ) 3775 for (wl = childs [i]; wl; )
3725 { 3776 {
3726 wn = wl->next; 3777 wn = wl->next;
3727 cb (EV_A_ EV_CHILD, wl); 3778 cb (EV_A_ EV_CHILD, wl);
3728 wl = wn; 3779 wl = wn;
3729 } 3780 }
3781#endif
3730/* EV_STAT 0x00001000 /* stat data changed */ 3782/* EV_STAT 0x00001000 /* stat data changed */
3731/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */ 3783/* EV_EMBED 0x00010000 /* embedded event loop needs sweep */
3732} 3784}
3733#endif 3785#endif
3734 3786

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines