… | |
… | |
207 | #elif defined (MAXSIG) |
207 | #elif defined (MAXSIG) |
208 | # define EV_NSIG (MAXSIG+1) |
208 | # define EV_NSIG (MAXSIG+1) |
209 | #elif defined (MAX_SIG) |
209 | #elif defined (MAX_SIG) |
210 | # define EV_NSIG (MAX_SIG+1) |
210 | # define EV_NSIG (MAX_SIG+1) |
211 | #elif defined (SIGARRAYSIZE) |
211 | #elif defined (SIGARRAYSIZE) |
212 | # define EV_NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */ |
212 | # define EV_NSIG (SIGARRAYSIZE) /* Assume ary[SIGARRAYSIZE] */ |
213 | #elif defined (_sys_nsig) |
213 | #elif defined (_sys_nsig) |
214 | # define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ |
214 | # define EV_NSIG (_sys_nsig) /* Solaris 2.5 */ |
215 | #else |
215 | #else |
216 | # error "unable to find value for NSIG, please report" |
216 | # error "unable to find value for NSIG, please report" |
217 | /* 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! :) */ |
218 | # define EV_NSIG 65 |
219 | # define EV_NSIG 65 |
219 | #endif |
220 | #endif |
220 | |
221 | |
221 | #ifndef EV_USE_CLOCK_SYSCALL |
222 | #ifndef EV_USE_CLOCK_SYSCALL |
222 | # if __linux && __GLIBC__ >= 2 |
223 | # if __linux && __GLIBC__ >= 2 |
… | |
… | |
890 | } |
891 | } |
891 | |
892 | |
892 | /*****************************************************************************/ |
893 | /*****************************************************************************/ |
893 | |
894 | |
894 | inline_speed void |
895 | inline_speed void |
895 | fd_event_nc (EV_P_ int fd, int revents) |
896 | fd_event_nocheck (EV_P_ int fd, int revents) |
896 | { |
897 | { |
897 | ANFD *anfd = anfds + fd; |
898 | ANFD *anfd = anfds + fd; |
898 | ev_io *w; |
899 | ev_io *w; |
899 | |
900 | |
900 | 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) |
… | |
… | |
912 | fd_event (EV_P_ int fd, int revents) |
913 | fd_event (EV_P_ int fd, int revents) |
913 | { |
914 | { |
914 | ANFD *anfd = anfds + fd; |
915 | ANFD *anfd = anfds + fd; |
915 | |
916 | |
916 | if (expect_true (!anfd->reify)) |
917 | if (expect_true (!anfd->reify)) |
917 | fd_event_nc (EV_A_ fd, revents); |
918 | fd_event_nocheck (EV_A_ fd, revents); |
918 | } |
919 | } |
919 | |
920 | |
920 | void |
921 | void |
921 | ev_feed_fd_event (EV_P_ int fd, int revents) |
922 | ev_feed_fd_event (EV_P_ int fd, int revents) |
922 | { |
923 | { |
923 | if (fd >= 0 && fd < anfdmax) |
924 | if (fd >= 0 && fd < anfdmax) |
924 | fd_event_nc (EV_A_ fd, revents); |
925 | fd_event_nocheck (EV_A_ fd, revents); |
925 | } |
926 | } |
926 | |
927 | |
927 | /* make sure the external fd watch events are in-sync */ |
928 | /* make sure the external fd watch events are in-sync */ |
928 | /* with the kernel/libev internal state */ |
929 | /* with the kernel/libev internal state */ |
929 | inline_size void |
930 | inline_size void |
… | |
… | |
992 | ev_io_stop (EV_A_ w); |
993 | ev_io_stop (EV_A_ w); |
993 | 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); |
994 | } |
995 | } |
995 | } |
996 | } |
996 | |
997 | |
997 | /* check whether the given fd is atcually valid, for error recovery */ |
998 | /* check whether the given fd is actually valid, for error recovery */ |
998 | inline_size int |
999 | inline_size int |
999 | fd_valid (int fd) |
1000 | fd_valid (int fd) |
1000 | { |
1001 | { |
1001 | #ifdef _WIN32 |
1002 | #ifdef _WIN32 |
1002 | return EV_FD_TO_WIN32_HANDLE (fd) != -1; |
1003 | return EV_FD_TO_WIN32_HANDLE (fd) != -1; |
… | |
… | |
1042 | { |
1043 | { |
1043 | anfds [fd].events = 0; |
1044 | anfds [fd].events = 0; |
1044 | anfds [fd].emask = 0; |
1045 | anfds [fd].emask = 0; |
1045 | fd_change (EV_A_ fd, EV__IOFDSET | EV_ANFD_REIFY); |
1046 | fd_change (EV_A_ fd, EV__IOFDSET | EV_ANFD_REIFY); |
1046 | } |
1047 | } |
|
|
1048 | } |
|
|
1049 | |
|
|
1050 | /* used to prepare libev internal fd's */ |
|
|
1051 | /* this is not fork-safe */ |
|
|
1052 | inline_speed void |
|
|
1053 | fd_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 |
1047 | } |
1062 | } |
1048 | |
1063 | |
1049 | /*****************************************************************************/ |
1064 | /*****************************************************************************/ |
1050 | |
1065 | |
1051 | /* |
1066 | /* |
… | |
… | |
1205 | |
1220 | |
1206 | static ANSIG signals [EV_NSIG - 1]; |
1221 | static ANSIG signals [EV_NSIG - 1]; |
1207 | |
1222 | |
1208 | /*****************************************************************************/ |
1223 | /*****************************************************************************/ |
1209 | |
1224 | |
1210 | /* used to prepare libev internal fd's */ |
1225 | #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE |
1211 | /* this is not fork-safe */ |
|
|
1212 | inline_speed void |
|
|
1213 | fd_intern (int fd) |
|
|
1214 | { |
|
|
1215 | #ifdef _WIN32 |
|
|
1216 | unsigned long arg = 1; |
|
|
1217 | ioctlsocket (EV_FD_TO_WIN32_HANDLE (fd), FIONBIO, &arg); |
|
|
1218 | #else |
|
|
1219 | fcntl (fd, F_SETFD, FD_CLOEXEC); |
|
|
1220 | fcntl (fd, F_SETFL, O_NONBLOCK); |
|
|
1221 | #endif |
|
|
1222 | } |
|
|
1223 | |
1226 | |
1224 | static void noinline |
1227 | static void noinline |
1225 | evpipe_init (EV_P) |
1228 | evpipe_init (EV_P) |
1226 | { |
1229 | { |
1227 | if (!ev_is_active (&pipe_w)) |
1230 | if (!ev_is_active (&pipe_w)) |
1228 | { |
1231 | { |
1229 | #if EV_USE_EVENTFD |
1232 | # if EV_USE_EVENTFD |
1230 | evfd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC); |
1233 | evfd = eventfd (0, EFD_NONBLOCK | EFD_CLOEXEC); |
1231 | if (evfd < 0 && errno == EINVAL) |
1234 | if (evfd < 0 && errno == EINVAL) |
1232 | evfd = eventfd (0, 0); |
1235 | evfd = eventfd (0, 0); |
1233 | |
1236 | |
1234 | if (evfd >= 0) |
1237 | if (evfd >= 0) |
… | |
… | |
1236 | evpipe [0] = -1; |
1239 | evpipe [0] = -1; |
1237 | fd_intern (evfd); /* doing it twice doesn't hurt */ |
1240 | fd_intern (evfd); /* doing it twice doesn't hurt */ |
1238 | ev_io_set (&pipe_w, evfd, EV_READ); |
1241 | ev_io_set (&pipe_w, evfd, EV_READ); |
1239 | } |
1242 | } |
1240 | else |
1243 | else |
1241 | #endif |
1244 | # endif |
1242 | { |
1245 | { |
1243 | while (pipe (evpipe)) |
1246 | while (pipe (evpipe)) |
1244 | ev_syserr ("(libev) error creating signal/async pipe"); |
1247 | ev_syserr ("(libev) error creating signal/async pipe"); |
1245 | |
1248 | |
1246 | fd_intern (evpipe [0]); |
1249 | fd_intern (evpipe [0]); |
… | |
… | |
1257 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1260 | evpipe_write (EV_P_ EV_ATOMIC_T *flag) |
1258 | { |
1261 | { |
1259 | if (!*flag) |
1262 | if (!*flag) |
1260 | { |
1263 | { |
1261 | 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; |
1262 | |
1266 | |
1263 | *flag = 1; |
1267 | *flag = 1; |
1264 | |
1268 | |
1265 | #if EV_USE_EVENTFD |
1269 | #if EV_USE_EVENTFD |
1266 | if (evfd >= 0) |
1270 | if (evfd >= 0) |
… | |
… | |
1268 | uint64_t counter = 1; |
1272 | uint64_t counter = 1; |
1269 | write (evfd, &counter, sizeof (uint64_t)); |
1273 | write (evfd, &counter, sizeof (uint64_t)); |
1270 | } |
1274 | } |
1271 | else |
1275 | else |
1272 | #endif |
1276 | #endif |
1273 | write (evpipe [1], &old_errno, 1); |
1277 | write (evpipe [1], &dummy, 1); |
1274 | |
1278 | |
1275 | errno = old_errno; |
1279 | errno = old_errno; |
1276 | } |
1280 | } |
1277 | } |
1281 | } |
1278 | |
1282 | |
… | |
… | |
1379 | break; |
1383 | break; |
1380 | } |
1384 | } |
1381 | } |
1385 | } |
1382 | #endif |
1386 | #endif |
1383 | |
1387 | |
|
|
1388 | #endif |
|
|
1389 | |
1384 | /*****************************************************************************/ |
1390 | /*****************************************************************************/ |
1385 | |
1391 | |
|
|
1392 | #if EV_CHILD_ENABLE |
1386 | static WL childs [EV_PID_HASHSIZE]; |
1393 | static WL childs [EV_PID_HASHSIZE]; |
1387 | |
|
|
1388 | #ifndef _WIN32 |
|
|
1389 | |
1394 | |
1390 | static ev_signal childev; |
1395 | static ev_signal childev; |
1391 | |
1396 | |
1392 | #ifndef WIFCONTINUED |
1397 | #ifndef WIFCONTINUED |
1393 | # define WIFCONTINUED(status) 0 |
1398 | # define WIFCONTINUED(status) 0 |
… | |
… | |
1662 | if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags); |
1667 | if (!backend && (flags & EVBACKEND_SELECT)) backend = select_init (EV_A_ flags); |
1663 | #endif |
1668 | #endif |
1664 | |
1669 | |
1665 | ev_prepare_init (&pending_w, pendingcb); |
1670 | ev_prepare_init (&pending_w, pendingcb); |
1666 | |
1671 | |
|
|
1672 | #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE |
1667 | ev_init (&pipe_w, pipecb); |
1673 | ev_init (&pipe_w, pipecb); |
1668 | ev_set_priority (&pipe_w, EV_MAXPRI); |
1674 | ev_set_priority (&pipe_w, EV_MAXPRI); |
|
|
1675 | #endif |
1669 | } |
1676 | } |
1670 | } |
1677 | } |
1671 | |
1678 | |
1672 | /* free up a loop structure */ |
1679 | /* free up a loop structure */ |
1673 | static void noinline |
1680 | static void noinline |
… | |
… | |
1791 | { |
1798 | { |
1792 | EV_WIN32_CLOSE_FD (evpipe [0]); |
1799 | EV_WIN32_CLOSE_FD (evpipe [0]); |
1793 | EV_WIN32_CLOSE_FD (evpipe [1]); |
1800 | EV_WIN32_CLOSE_FD (evpipe [1]); |
1794 | } |
1801 | } |
1795 | |
1802 | |
|
|
1803 | #if EV_SIGNAL_ENABLE || EV_ASYNC_ENABLE |
1796 | evpipe_init (EV_A); |
1804 | evpipe_init (EV_A); |
1797 | /* now iterate over everything, in case we missed something */ |
1805 | /* now iterate over everything, in case we missed something */ |
1798 | pipecb (EV_A_ &pipe_w, EV_READ); |
1806 | pipecb (EV_A_ &pipe_w, EV_READ); |
|
|
1807 | #endif |
1799 | } |
1808 | } |
1800 | |
1809 | |
1801 | postfork = 0; |
1810 | postfork = 0; |
1802 | } |
1811 | } |
1803 | |
1812 | |
… | |
… | |
1916 | #if EV_ASYNC_ENABLE |
1925 | #if EV_ASYNC_ENABLE |
1917 | assert (asyncmax >= asynccnt); |
1926 | assert (asyncmax >= asynccnt); |
1918 | array_verify (EV_A_ (W *)asyncs, asynccnt); |
1927 | array_verify (EV_A_ (W *)asyncs, asynccnt); |
1919 | #endif |
1928 | #endif |
1920 | |
1929 | |
|
|
1930 | #if EV_PREPARE_ENABLE |
1921 | assert (preparemax >= preparecnt); |
1931 | assert (preparemax >= preparecnt); |
1922 | array_verify (EV_A_ (W *)prepares, preparecnt); |
1932 | array_verify (EV_A_ (W *)prepares, preparecnt); |
|
|
1933 | #endif |
1923 | |
1934 | |
|
|
1935 | #if EV_CHECK_ENABLE |
1924 | assert (checkmax >= checkcnt); |
1936 | assert (checkmax >= checkcnt); |
1925 | array_verify (EV_A_ (W *)checks, checkcnt); |
1937 | array_verify (EV_A_ (W *)checks, checkcnt); |
|
|
1938 | #endif |
1926 | |
1939 | |
1927 | # if 0 |
1940 | # if 0 |
|
|
1941 | #if EV_CHILD_ENABLE |
1928 | 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) |
1929 | for (signum = EV_NSIG; signum--; ) if (signals [signum].pending) |
1943 | for (signum = EV_NSIG; signum--; ) if (signals [signum].pending) |
|
|
1944 | #endif |
1930 | # endif |
1945 | # endif |
1931 | #endif |
1946 | #endif |
1932 | } |
1947 | } |
1933 | #endif |
1948 | #endif |
1934 | |
1949 | |
… | |
… | |
1950 | |
1965 | |
1951 | loop_init (EV_A_ flags); |
1966 | loop_init (EV_A_ flags); |
1952 | |
1967 | |
1953 | if (ev_backend (EV_A)) |
1968 | if (ev_backend (EV_A)) |
1954 | { |
1969 | { |
1955 | #ifndef _WIN32 |
1970 | #if EV_CHILD_ENABLE |
1956 | ev_signal_init (&childev, childcb, SIGCHLD); |
1971 | ev_signal_init (&childev, childcb, SIGCHLD); |
1957 | ev_set_priority (&childev, EV_MAXPRI); |
1972 | ev_set_priority (&childev, EV_MAXPRI); |
1958 | ev_signal_start (EV_A_ &childev); |
1973 | ev_signal_start (EV_A_ &childev); |
1959 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
1974 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
1960 | #endif |
1975 | #endif |
… | |
… | |
1973 | EV_P = ev_default_loop_ptr; |
1988 | EV_P = ev_default_loop_ptr; |
1974 | #endif |
1989 | #endif |
1975 | |
1990 | |
1976 | ev_default_loop_ptr = 0; |
1991 | ev_default_loop_ptr = 0; |
1977 | |
1992 | |
1978 | #ifndef _WIN32 |
1993 | #if EV_CHILD_ENABLE |
1979 | ev_ref (EV_A); /* child watcher */ |
1994 | ev_ref (EV_A); /* child watcher */ |
1980 | ev_signal_stop (EV_A_ &childev); |
1995 | ev_signal_stop (EV_A_ &childev); |
1981 | #endif |
1996 | #endif |
1982 | |
1997 | |
1983 | loop_destroy (EV_A); |
1998 | loop_destroy (EV_A); |
… | |
… | |
2295 | queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK); |
2310 | queue_events (EV_A_ (W *)forks, forkcnt, EV_FORK); |
2296 | EV_INVOKE_PENDING; |
2311 | EV_INVOKE_PENDING; |
2297 | } |
2312 | } |
2298 | #endif |
2313 | #endif |
2299 | |
2314 | |
|
|
2315 | #if EV_PREPARE_ENABLE |
2300 | /* queue prepare watchers (and execute them) */ |
2316 | /* queue prepare watchers (and execute them) */ |
2301 | if (expect_false (preparecnt)) |
2317 | if (expect_false (preparecnt)) |
2302 | { |
2318 | { |
2303 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
2319 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
2304 | EV_INVOKE_PENDING; |
2320 | EV_INVOKE_PENDING; |
2305 | } |
2321 | } |
|
|
2322 | #endif |
2306 | |
2323 | |
2307 | if (expect_false (loop_done)) |
2324 | if (expect_false (loop_done)) |
2308 | break; |
2325 | break; |
2309 | |
2326 | |
2310 | /* we might have forked, so reify kernel state if necessary */ |
2327 | /* we might have forked, so reify kernel state if necessary */ |
… | |
… | |
2383 | #if EV_IDLE_ENABLE |
2400 | #if EV_IDLE_ENABLE |
2384 | /* queue idle watchers unless other events are pending */ |
2401 | /* queue idle watchers unless other events are pending */ |
2385 | idle_reify (EV_A); |
2402 | idle_reify (EV_A); |
2386 | #endif |
2403 | #endif |
2387 | |
2404 | |
|
|
2405 | #if EV_CHECK_ENABLE |
2388 | /* queue check watchers, to be executed first */ |
2406 | /* queue check watchers, to be executed first */ |
2389 | if (expect_false (checkcnt)) |
2407 | if (expect_false (checkcnt)) |
2390 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
2408 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
|
|
2409 | #endif |
2391 | |
2410 | |
2392 | EV_INVOKE_PENDING; |
2411 | EV_INVOKE_PENDING; |
2393 | } |
2412 | } |
2394 | while (expect_true ( |
2413 | while (expect_true ( |
2395 | activecnt |
2414 | activecnt |
… | |
… | |
2725 | |
2744 | |
2726 | #ifndef SA_RESTART |
2745 | #ifndef SA_RESTART |
2727 | # define SA_RESTART 0 |
2746 | # define SA_RESTART 0 |
2728 | #endif |
2747 | #endif |
2729 | |
2748 | |
|
|
2749 | #if EV_SIGNAL_ENABLE |
|
|
2750 | |
2730 | void noinline |
2751 | void noinline |
2731 | ev_signal_start (EV_P_ ev_signal *w) |
2752 | ev_signal_start (EV_P_ ev_signal *w) |
2732 | { |
2753 | { |
2733 | if (expect_false (ev_is_active (w))) |
2754 | if (expect_false (ev_is_active (w))) |
2734 | return; |
2755 | return; |
… | |
… | |
2840 | } |
2861 | } |
2841 | |
2862 | |
2842 | EV_FREQUENT_CHECK; |
2863 | EV_FREQUENT_CHECK; |
2843 | } |
2864 | } |
2844 | |
2865 | |
|
|
2866 | #endif |
|
|
2867 | |
|
|
2868 | #if EV_CHILD_ENABLE |
|
|
2869 | |
2845 | void |
2870 | void |
2846 | ev_child_start (EV_P_ ev_child *w) |
2871 | ev_child_start (EV_P_ ev_child *w) |
2847 | { |
2872 | { |
2848 | #if EV_MULTIPLICITY |
2873 | #if EV_MULTIPLICITY |
2849 | 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)); |
… | |
… | |
2871 | wlist_del (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
2896 | wlist_del (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
2872 | ev_stop (EV_A_ (W)w); |
2897 | ev_stop (EV_A_ (W)w); |
2873 | |
2898 | |
2874 | EV_FREQUENT_CHECK; |
2899 | EV_FREQUENT_CHECK; |
2875 | } |
2900 | } |
|
|
2901 | |
|
|
2902 | #endif |
2876 | |
2903 | |
2877 | #if EV_STAT_ENABLE |
2904 | #if EV_STAT_ENABLE |
2878 | |
2905 | |
2879 | # ifdef _WIN32 |
2906 | # ifdef _WIN32 |
2880 | # undef lstat |
2907 | # undef lstat |
… | |
… | |
3301 | |
3328 | |
3302 | EV_FREQUENT_CHECK; |
3329 | EV_FREQUENT_CHECK; |
3303 | } |
3330 | } |
3304 | #endif |
3331 | #endif |
3305 | |
3332 | |
|
|
3333 | #if EV_PREPARE_ENABLE |
3306 | void |
3334 | void |
3307 | ev_prepare_start (EV_P_ ev_prepare *w) |
3335 | ev_prepare_start (EV_P_ ev_prepare *w) |
3308 | { |
3336 | { |
3309 | if (expect_false (ev_is_active (w))) |
3337 | if (expect_false (ev_is_active (w))) |
3310 | return; |
3338 | return; |
… | |
… | |
3336 | |
3364 | |
3337 | ev_stop (EV_A_ (W)w); |
3365 | ev_stop (EV_A_ (W)w); |
3338 | |
3366 | |
3339 | EV_FREQUENT_CHECK; |
3367 | EV_FREQUENT_CHECK; |
3340 | } |
3368 | } |
|
|
3369 | #endif |
3341 | |
3370 | |
|
|
3371 | #if EV_CHECK_ENABLE |
3342 | void |
3372 | void |
3343 | ev_check_start (EV_P_ ev_check *w) |
3373 | ev_check_start (EV_P_ ev_check *w) |
3344 | { |
3374 | { |
3345 | if (expect_false (ev_is_active (w))) |
3375 | if (expect_false (ev_is_active (w))) |
3346 | return; |
3376 | return; |
… | |
… | |
3372 | |
3402 | |
3373 | ev_stop (EV_A_ (W)w); |
3403 | ev_stop (EV_A_ (W)w); |
3374 | |
3404 | |
3375 | EV_FREQUENT_CHECK; |
3405 | EV_FREQUENT_CHECK; |
3376 | } |
3406 | } |
|
|
3407 | #endif |
3377 | |
3408 | |
3378 | #if EV_EMBED_ENABLE |
3409 | #if EV_EMBED_ENABLE |
3379 | void noinline |
3410 | void noinline |
3380 | ev_embed_sweep (EV_P_ ev_embed *w) |
3411 | ev_embed_sweep (EV_P_ ev_embed *w) |
3381 | { |
3412 | { |
… | |
… | |
3710 | if (types & EV_ASYNC) |
3741 | if (types & EV_ASYNC) |
3711 | for (i = asynccnt; i--; ) |
3742 | for (i = asynccnt; i--; ) |
3712 | cb (EV_A_ EV_ASYNC, asyncs [i]); |
3743 | cb (EV_A_ EV_ASYNC, asyncs [i]); |
3713 | #endif |
3744 | #endif |
3714 | |
3745 | |
|
|
3746 | #if EV_PREPARE_ENABLE |
3715 | if (types & EV_PREPARE) |
3747 | if (types & EV_PREPARE) |
3716 | for (i = preparecnt; i--; ) |
3748 | for (i = preparecnt; i--; ) |
3717 | #if EV_EMBED_ENABLE |
3749 | # if EV_EMBED_ENABLE |
3718 | if (ev_cb (prepares [i]) != embed_prepare_cb) |
3750 | if (ev_cb (prepares [i]) != embed_prepare_cb) |
3719 | #endif |
3751 | # endif |
3720 | cb (EV_A_ EV_PREPARE, prepares [i]); |
3752 | cb (EV_A_ EV_PREPARE, prepares [i]); |
|
|
3753 | #endif |
3721 | |
3754 | |
|
|
3755 | #if EV_CHECK_ENABLE |
3722 | if (types & EV_CHECK) |
3756 | if (types & EV_CHECK) |
3723 | for (i = checkcnt; i--; ) |
3757 | for (i = checkcnt; i--; ) |
3724 | cb (EV_A_ EV_CHECK, checks [i]); |
3758 | cb (EV_A_ EV_CHECK, checks [i]); |
|
|
3759 | #endif |
3725 | |
3760 | |
|
|
3761 | #if EV_SIGNAL_ENABLE |
3726 | if (types & EV_SIGNAL) |
3762 | if (types & EV_SIGNAL) |
3727 | for (i = 0; i < EV_NSIG - 1; ++i) |
3763 | for (i = 0; i < EV_NSIG - 1; ++i) |
3728 | for (wl = signals [i].head; wl; ) |
3764 | for (wl = signals [i].head; wl; ) |
3729 | { |
3765 | { |
3730 | wn = wl->next; |
3766 | wn = wl->next; |
3731 | cb (EV_A_ EV_SIGNAL, wl); |
3767 | cb (EV_A_ EV_SIGNAL, wl); |
3732 | wl = wn; |
3768 | wl = wn; |
3733 | } |
3769 | } |
|
|
3770 | #endif |
3734 | |
3771 | |
|
|
3772 | #if EV_CHILD_ENABLE |
3735 | if (types & EV_CHILD) |
3773 | if (types & EV_CHILD) |
3736 | for (i = EV_PID_HASHSIZE; i--; ) |
3774 | for (i = EV_PID_HASHSIZE; i--; ) |
3737 | for (wl = childs [i]; wl; ) |
3775 | for (wl = childs [i]; wl; ) |
3738 | { |
3776 | { |
3739 | wn = wl->next; |
3777 | wn = wl->next; |
3740 | cb (EV_A_ EV_CHILD, wl); |
3778 | cb (EV_A_ EV_CHILD, wl); |
3741 | wl = wn; |
3779 | wl = wn; |
3742 | } |
3780 | } |
|
|
3781 | #endif |
3743 | /* EV_STAT 0x00001000 /* stat data changed */ |
3782 | /* EV_STAT 0x00001000 /* stat data changed */ |
3744 | /* EV_EMBED 0x00010000 /* embedded event loop needs sweep */ |
3783 | /* EV_EMBED 0x00010000 /* embedded event loop needs sweep */ |
3745 | } |
3784 | } |
3746 | #endif |
3785 | #endif |
3747 | |
3786 | |