… | |
… | |
59 | |
59 | |
60 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) |
60 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H && !defined (EV_USE_KQUEUE) |
61 | # define EV_USE_KQUEUE 1 |
61 | # define EV_USE_KQUEUE 1 |
62 | # endif |
62 | # endif |
63 | |
63 | |
|
|
64 | # if HAVE_PORT_H && HAVE_PORT_CREATE && !defined (EV_USE_PORT) |
|
|
65 | # define EV_USE_PORT 1 |
|
|
66 | # endif |
|
|
67 | |
64 | #endif |
68 | #endif |
65 | |
69 | |
66 | #include <math.h> |
70 | #include <math.h> |
67 | #include <stdlib.h> |
71 | #include <stdlib.h> |
68 | #include <fcntl.h> |
72 | #include <fcntl.h> |
… | |
… | |
93 | |
97 | |
94 | #ifndef EV_USE_MONOTONIC |
98 | #ifndef EV_USE_MONOTONIC |
95 | # define EV_USE_MONOTONIC 1 |
99 | # define EV_USE_MONOTONIC 1 |
96 | #endif |
100 | #endif |
97 | |
101 | |
|
|
102 | #ifndef EV_USE_REALTIME |
|
|
103 | # define EV_USE_REALTIME 1 |
|
|
104 | #endif |
|
|
105 | |
98 | #ifndef EV_USE_SELECT |
106 | #ifndef EV_USE_SELECT |
99 | # define EV_USE_SELECT 1 |
107 | # define EV_USE_SELECT 1 |
100 | # define EV_SELECT_USE_FD_SET 1 |
108 | # define EV_SELECT_USE_FD_SET 1 |
101 | #endif |
109 | #endif |
102 | |
110 | |
… | |
… | |
114 | |
122 | |
115 | #ifndef EV_USE_KQUEUE |
123 | #ifndef EV_USE_KQUEUE |
116 | # define EV_USE_KQUEUE 0 |
124 | # define EV_USE_KQUEUE 0 |
117 | #endif |
125 | #endif |
118 | |
126 | |
119 | #ifndef EV_USE_REALTIME |
127 | #ifndef EV_USE_PORT |
120 | # define EV_USE_REALTIME 1 |
128 | # define EV_USE_PORT 0 |
121 | #endif |
129 | #endif |
122 | |
130 | |
123 | /**/ |
131 | /**/ |
124 | |
132 | |
125 | /* darwin simply cannot be helped */ |
133 | /* darwin simply cannot be helped */ |
… | |
… | |
167 | #define expect_true(expr) expect ((expr) != 0, 1) |
175 | #define expect_true(expr) expect ((expr) != 0, 1) |
168 | |
176 | |
169 | #define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) |
177 | #define NUMPRI (EV_MAXPRI - EV_MINPRI + 1) |
170 | #define ABSPRI(w) ((w)->priority - EV_MINPRI) |
178 | #define ABSPRI(w) ((w)->priority - EV_MINPRI) |
171 | |
179 | |
172 | #define EMPTY /* required for microsofts broken pseudo-c compiler */ |
180 | #define EMPTY0 /* required for microsofts broken pseudo-c compiler */ |
|
|
181 | #define EMPTY2(a,b) /* used to suppress some warnings */ |
173 | |
182 | |
174 | typedef struct ev_watcher *W; |
183 | typedef struct ev_watcher *W; |
175 | typedef struct ev_watcher_list *WL; |
184 | typedef struct ev_watcher_list *WL; |
176 | typedef struct ev_watcher_time *WT; |
185 | typedef struct ev_watcher_time *WT; |
177 | |
186 | |
… | |
… | |
257 | #include "ev_vars.h" |
266 | #include "ev_vars.h" |
258 | #undef VAR |
267 | #undef VAR |
259 | }; |
268 | }; |
260 | #include "ev_wrap.h" |
269 | #include "ev_wrap.h" |
261 | |
270 | |
262 | struct ev_loop default_loop_struct; |
271 | static struct ev_loop default_loop_struct; |
263 | static struct ev_loop *default_loop; |
272 | struct ev_loop *ev_default_loop_ptr; |
264 | |
273 | |
265 | #else |
274 | #else |
266 | |
275 | |
267 | ev_tstamp ev_rt_now; |
276 | ev_tstamp ev_rt_now; |
268 | #define VAR(name,decl) static decl; |
277 | #define VAR(name,decl) static decl; |
269 | #include "ev_vars.h" |
278 | #include "ev_vars.h" |
270 | #undef VAR |
279 | #undef VAR |
271 | |
280 | |
272 | static int default_loop; |
281 | static int ev_default_loop_ptr; |
273 | |
282 | |
274 | #endif |
283 | #endif |
275 | |
284 | |
276 | /*****************************************************************************/ |
285 | /*****************************************************************************/ |
277 | |
286 | |
… | |
… | |
365 | pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; |
374 | pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; |
366 | return; |
375 | return; |
367 | } |
376 | } |
368 | |
377 | |
369 | w_->pending = ++pendingcnt [ABSPRI (w_)]; |
378 | w_->pending = ++pendingcnt [ABSPRI (w_)]; |
370 | array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], (void)); |
379 | array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], EMPTY2); |
371 | pendings [ABSPRI (w_)][w_->pending - 1].w = w_; |
380 | pendings [ABSPRI (w_)][w_->pending - 1].w = w_; |
372 | pendings [ABSPRI (w_)][w_->pending - 1].events = revents; |
381 | pendings [ABSPRI (w_)][w_->pending - 1].events = revents; |
373 | } |
382 | } |
374 | |
383 | |
375 | static void |
384 | static void |
… | |
… | |
445 | return; |
454 | return; |
446 | |
455 | |
447 | anfds [fd].reify = 1; |
456 | anfds [fd].reify = 1; |
448 | |
457 | |
449 | ++fdchangecnt; |
458 | ++fdchangecnt; |
450 | array_needsize (int, fdchanges, fdchangemax, fdchangecnt, (void)); |
459 | array_needsize (int, fdchanges, fdchangemax, fdchangecnt, EMPTY2); |
451 | fdchanges [fdchangecnt - 1] = fd; |
460 | fdchanges [fdchangecnt - 1] = fd; |
452 | } |
461 | } |
453 | |
462 | |
454 | static void |
463 | static void |
455 | fd_kill (EV_P_ int fd) |
464 | fd_kill (EV_P_ int fd) |
… | |
… | |
613 | ev_feed_signal_event (EV_P_ int signum) |
622 | ev_feed_signal_event (EV_P_ int signum) |
614 | { |
623 | { |
615 | WL w; |
624 | WL w; |
616 | |
625 | |
617 | #if EV_MULTIPLICITY |
626 | #if EV_MULTIPLICITY |
618 | assert (("feeding signal events is only supported in the default loop", loop == default_loop)); |
627 | assert (("feeding signal events is only supported in the default loop", loop == ev_default_loop_ptr)); |
619 | #endif |
628 | #endif |
620 | |
629 | |
621 | --signum; |
630 | --signum; |
622 | |
631 | |
623 | if (signum < 0 || signum >= signalmax) |
632 | if (signum < 0 || signum >= signalmax) |
… | |
… | |
709 | |
718 | |
710 | #endif |
719 | #endif |
711 | |
720 | |
712 | /*****************************************************************************/ |
721 | /*****************************************************************************/ |
713 | |
722 | |
|
|
723 | #if EV_USE_PORT |
|
|
724 | # include "ev_port.c" |
|
|
725 | #endif |
714 | #if EV_USE_KQUEUE |
726 | #if EV_USE_KQUEUE |
715 | # include "ev_kqueue.c" |
727 | # include "ev_kqueue.c" |
716 | #endif |
728 | #endif |
717 | #if EV_USE_EPOLL |
729 | #if EV_USE_EPOLL |
718 | # include "ev_epoll.c" |
730 | # include "ev_epoll.c" |
… | |
… | |
770 | ev_rt_now = ev_time (); |
782 | ev_rt_now = ev_time (); |
771 | mn_now = get_clock (); |
783 | mn_now = get_clock (); |
772 | now_floor = mn_now; |
784 | now_floor = mn_now; |
773 | rtmn_diff = ev_rt_now - mn_now; |
785 | rtmn_diff = ev_rt_now - mn_now; |
774 | |
786 | |
775 | if (!(flags & EVMETHOD_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS")) |
787 | if (!(flags & EVFLAG_NOENV) && !enable_secure () && getenv ("LIBEV_FLAGS")) |
776 | flags = atoi (getenv ("LIBEV_FLAGS")); |
788 | flags = atoi (getenv ("LIBEV_FLAGS")); |
777 | |
789 | |
778 | if (!(flags & 0x0000ffff)) |
790 | if (!(flags & 0x0000ffff)) |
779 | flags |= 0x0000ffff; |
791 | flags |= 0x0000ffff; |
780 | |
792 | |
781 | method = 0; |
793 | method = 0; |
|
|
794 | #if EV_USE_PORT |
|
|
795 | if (!method && (flags & EVMETHOD_PORT )) method = port_init (EV_A_ flags); |
|
|
796 | #endif |
782 | #if EV_USE_KQUEUE |
797 | #if EV_USE_KQUEUE |
783 | if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags); |
798 | if (!method && (flags & EVMETHOD_KQUEUE)) method = kqueue_init (EV_A_ flags); |
784 | #endif |
799 | #endif |
785 | #if EV_USE_EPOLL |
800 | #if EV_USE_EPOLL |
786 | if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags); |
801 | if (!method && (flags & EVMETHOD_EPOLL )) method = epoll_init (EV_A_ flags); |
… | |
… | |
800 | void |
815 | void |
801 | loop_destroy (EV_P) |
816 | loop_destroy (EV_P) |
802 | { |
817 | { |
803 | int i; |
818 | int i; |
804 | |
819 | |
|
|
820 | #if EV_USE_PORT |
|
|
821 | if (method == EVMETHOD_PORT ) port_destroy (EV_A); |
|
|
822 | #endif |
805 | #if EV_USE_KQUEUE |
823 | #if EV_USE_KQUEUE |
806 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
824 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
807 | #endif |
825 | #endif |
808 | #if EV_USE_EPOLL |
826 | #if EV_USE_EPOLL |
809 | if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); |
827 | if (method == EVMETHOD_EPOLL ) epoll_destroy (EV_A); |
… | |
… | |
817 | |
835 | |
818 | for (i = NUMPRI; i--; ) |
836 | for (i = NUMPRI; i--; ) |
819 | array_free (pending, [i]); |
837 | array_free (pending, [i]); |
820 | |
838 | |
821 | /* have to use the microsoft-never-gets-it-right macro */ |
839 | /* have to use the microsoft-never-gets-it-right macro */ |
822 | array_free (fdchange, EMPTY); |
840 | array_free (fdchange, EMPTY0); |
823 | array_free (timer, EMPTY); |
841 | array_free (timer, EMPTY0); |
824 | #if EV_PERIODICS |
842 | #if EV_PERIODICS |
825 | array_free (periodic, EMPTY); |
843 | array_free (periodic, EMPTY0); |
826 | #endif |
844 | #endif |
827 | array_free (idle, EMPTY); |
845 | array_free (idle, EMPTY0); |
828 | array_free (prepare, EMPTY); |
846 | array_free (prepare, EMPTY0); |
829 | array_free (check, EMPTY); |
847 | array_free (check, EMPTY0); |
830 | |
848 | |
831 | method = 0; |
849 | method = 0; |
832 | } |
850 | } |
833 | |
851 | |
834 | static void |
852 | static void |
835 | loop_fork (EV_P) |
853 | loop_fork (EV_P) |
836 | { |
854 | { |
|
|
855 | #if EV_USE_PORT |
|
|
856 | if (method == EVMETHOD_PORT ) port_fork (EV_A); |
|
|
857 | #endif |
|
|
858 | #if EV_USE_KQUEUE |
|
|
859 | if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A); |
|
|
860 | #endif |
837 | #if EV_USE_EPOLL |
861 | #if EV_USE_EPOLL |
838 | if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); |
862 | if (method == EVMETHOD_EPOLL ) epoll_fork (EV_A); |
839 | #endif |
|
|
840 | #if EV_USE_KQUEUE |
|
|
841 | if (method == EVMETHOD_KQUEUE) kqueue_fork (EV_A); |
|
|
842 | #endif |
863 | #endif |
843 | |
864 | |
844 | if (ev_is_active (&sigev)) |
865 | if (ev_is_active (&sigev)) |
845 | { |
866 | { |
846 | /* default loop */ |
867 | /* default loop */ |
… | |
… | |
890 | |
911 | |
891 | #endif |
912 | #endif |
892 | |
913 | |
893 | #if EV_MULTIPLICITY |
914 | #if EV_MULTIPLICITY |
894 | struct ev_loop * |
915 | struct ev_loop * |
|
|
916 | ev_default_loop_ (unsigned int flags) |
895 | #else |
917 | #else |
896 | int |
918 | int |
897 | #endif |
|
|
898 | ev_default_loop (unsigned int flags) |
919 | ev_default_loop (unsigned int flags) |
|
|
920 | #endif |
899 | { |
921 | { |
900 | if (sigpipe [0] == sigpipe [1]) |
922 | if (sigpipe [0] == sigpipe [1]) |
901 | if (pipe (sigpipe)) |
923 | if (pipe (sigpipe)) |
902 | return 0; |
924 | return 0; |
903 | |
925 | |
904 | if (!default_loop) |
926 | if (!ev_default_loop_ptr) |
905 | { |
927 | { |
906 | #if EV_MULTIPLICITY |
928 | #if EV_MULTIPLICITY |
907 | struct ev_loop *loop = default_loop = &default_loop_struct; |
929 | struct ev_loop *loop = ev_default_loop_ptr = &default_loop_struct; |
908 | #else |
930 | #else |
909 | default_loop = 1; |
931 | ev_default_loop_ptr = 1; |
910 | #endif |
932 | #endif |
911 | |
933 | |
912 | loop_init (EV_A_ flags); |
934 | loop_init (EV_A_ flags); |
913 | |
935 | |
914 | if (ev_method (EV_A)) |
936 | if (ev_method (EV_A)) |
… | |
… | |
921 | ev_signal_start (EV_A_ &childev); |
943 | ev_signal_start (EV_A_ &childev); |
922 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
944 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
923 | #endif |
945 | #endif |
924 | } |
946 | } |
925 | else |
947 | else |
926 | default_loop = 0; |
948 | ev_default_loop_ptr = 0; |
927 | } |
949 | } |
928 | |
950 | |
929 | return default_loop; |
951 | return ev_default_loop_ptr; |
930 | } |
952 | } |
931 | |
953 | |
932 | void |
954 | void |
933 | ev_default_destroy (void) |
955 | ev_default_destroy (void) |
934 | { |
956 | { |
935 | #if EV_MULTIPLICITY |
957 | #if EV_MULTIPLICITY |
936 | struct ev_loop *loop = default_loop; |
958 | struct ev_loop *loop = ev_default_loop_ptr; |
937 | #endif |
959 | #endif |
938 | |
960 | |
939 | #ifndef _WIN32 |
961 | #ifndef _WIN32 |
940 | ev_ref (EV_A); /* child watcher */ |
962 | ev_ref (EV_A); /* child watcher */ |
941 | ev_signal_stop (EV_A_ &childev); |
963 | ev_signal_stop (EV_A_ &childev); |
… | |
… | |
952 | |
974 | |
953 | void |
975 | void |
954 | ev_default_fork (void) |
976 | ev_default_fork (void) |
955 | { |
977 | { |
956 | #if EV_MULTIPLICITY |
978 | #if EV_MULTIPLICITY |
957 | struct ev_loop *loop = default_loop; |
979 | struct ev_loop *loop = ev_default_loop_ptr; |
958 | #endif |
980 | #endif |
959 | |
981 | |
960 | if (method) |
982 | if (method) |
961 | postfork = 1; |
983 | postfork = 1; |
962 | } |
984 | } |
… | |
… | |
1159 | ev_loop (EV_P_ int flags) |
1181 | ev_loop (EV_P_ int flags) |
1160 | { |
1182 | { |
1161 | double block; |
1183 | double block; |
1162 | loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0; |
1184 | loop_done = flags & (EVLOOP_ONESHOT | EVLOOP_NONBLOCK) ? 1 : 0; |
1163 | |
1185 | |
1164 | do |
1186 | while (activecnt) |
1165 | { |
1187 | { |
1166 | /* queue check watchers (and execute them) */ |
1188 | /* queue check watchers (and execute them) */ |
1167 | if (expect_false (preparecnt)) |
1189 | if (expect_false (preparecnt)) |
1168 | { |
1190 | { |
1169 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
1191 | queue_events (EV_A_ (W *)prepares, preparecnt, EV_PREPARE); |
… | |
… | |
1232 | /* queue check watchers, to be executed first */ |
1254 | /* queue check watchers, to be executed first */ |
1233 | if (checkcnt) |
1255 | if (checkcnt) |
1234 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
1256 | queue_events (EV_A_ (W *)checks, checkcnt, EV_CHECK); |
1235 | |
1257 | |
1236 | call_pending (EV_A); |
1258 | call_pending (EV_A); |
|
|
1259 | |
|
|
1260 | if (loop_done) |
|
|
1261 | break; |
1237 | } |
1262 | } |
1238 | while (activecnt && !loop_done); |
|
|
1239 | |
1263 | |
1240 | if (loop_done != 2) |
1264 | if (loop_done != 2) |
1241 | loop_done = 0; |
1265 | loop_done = 0; |
1242 | } |
1266 | } |
1243 | |
1267 | |
… | |
… | |
1341 | ((WT)w)->at += mn_now; |
1365 | ((WT)w)->at += mn_now; |
1342 | |
1366 | |
1343 | assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.)); |
1367 | assert (("ev_timer_start called with negative timer repeat value", w->repeat >= 0.)); |
1344 | |
1368 | |
1345 | ev_start (EV_A_ (W)w, ++timercnt); |
1369 | ev_start (EV_A_ (W)w, ++timercnt); |
1346 | array_needsize (struct ev_timer *, timers, timermax, timercnt, (void)); |
1370 | array_needsize (struct ev_timer *, timers, timermax, timercnt, EMPTY2); |
1347 | timers [timercnt - 1] = w; |
1371 | timers [timercnt - 1] = w; |
1348 | upheap ((WT *)timers, timercnt - 1); |
1372 | upheap ((WT *)timers, timercnt - 1); |
1349 | |
1373 | |
1350 | assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); |
1374 | assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); |
1351 | } |
1375 | } |
… | |
… | |
1405 | /* this formula differs from the one in periodic_reify because we do not always round up */ |
1429 | /* this formula differs from the one in periodic_reify because we do not always round up */ |
1406 | ((WT)w)->at += ceil ((ev_rt_now - ((WT)w)->at) / w->interval) * w->interval; |
1430 | ((WT)w)->at += ceil ((ev_rt_now - ((WT)w)->at) / w->interval) * w->interval; |
1407 | } |
1431 | } |
1408 | |
1432 | |
1409 | ev_start (EV_A_ (W)w, ++periodiccnt); |
1433 | ev_start (EV_A_ (W)w, ++periodiccnt); |
1410 | array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, (void)); |
1434 | array_needsize (struct ev_periodic *, periodics, periodicmax, periodiccnt, EMPTY2); |
1411 | periodics [periodiccnt - 1] = w; |
1435 | periodics [periodiccnt - 1] = w; |
1412 | upheap ((WT *)periodics, periodiccnt - 1); |
1436 | upheap ((WT *)periodics, periodiccnt - 1); |
1413 | |
1437 | |
1414 | assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); |
1438 | assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); |
1415 | } |
1439 | } |
… | |
… | |
1446 | { |
1470 | { |
1447 | if (ev_is_active (w)) |
1471 | if (ev_is_active (w)) |
1448 | return; |
1472 | return; |
1449 | |
1473 | |
1450 | ev_start (EV_A_ (W)w, ++idlecnt); |
1474 | ev_start (EV_A_ (W)w, ++idlecnt); |
1451 | array_needsize (struct ev_idle *, idles, idlemax, idlecnt, (void)); |
1475 | array_needsize (struct ev_idle *, idles, idlemax, idlecnt, EMPTY2); |
1452 | idles [idlecnt - 1] = w; |
1476 | idles [idlecnt - 1] = w; |
1453 | } |
1477 | } |
1454 | |
1478 | |
1455 | void |
1479 | void |
1456 | ev_idle_stop (EV_P_ struct ev_idle *w) |
1480 | ev_idle_stop (EV_P_ struct ev_idle *w) |
… | |
… | |
1468 | { |
1492 | { |
1469 | if (ev_is_active (w)) |
1493 | if (ev_is_active (w)) |
1470 | return; |
1494 | return; |
1471 | |
1495 | |
1472 | ev_start (EV_A_ (W)w, ++preparecnt); |
1496 | ev_start (EV_A_ (W)w, ++preparecnt); |
1473 | array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, (void)); |
1497 | array_needsize (struct ev_prepare *, prepares, preparemax, preparecnt, EMPTY2); |
1474 | prepares [preparecnt - 1] = w; |
1498 | prepares [preparecnt - 1] = w; |
1475 | } |
1499 | } |
1476 | |
1500 | |
1477 | void |
1501 | void |
1478 | ev_prepare_stop (EV_P_ struct ev_prepare *w) |
1502 | ev_prepare_stop (EV_P_ struct ev_prepare *w) |
… | |
… | |
1490 | { |
1514 | { |
1491 | if (ev_is_active (w)) |
1515 | if (ev_is_active (w)) |
1492 | return; |
1516 | return; |
1493 | |
1517 | |
1494 | ev_start (EV_A_ (W)w, ++checkcnt); |
1518 | ev_start (EV_A_ (W)w, ++checkcnt); |
1495 | array_needsize (struct ev_check *, checks, checkmax, checkcnt, (void)); |
1519 | array_needsize (struct ev_check *, checks, checkmax, checkcnt, EMPTY2); |
1496 | checks [checkcnt - 1] = w; |
1520 | checks [checkcnt - 1] = w; |
1497 | } |
1521 | } |
1498 | |
1522 | |
1499 | void |
1523 | void |
1500 | ev_check_stop (EV_P_ struct ev_check *w) |
1524 | ev_check_stop (EV_P_ struct ev_check *w) |
… | |
… | |
1513 | |
1537 | |
1514 | void |
1538 | void |
1515 | ev_signal_start (EV_P_ struct ev_signal *w) |
1539 | ev_signal_start (EV_P_ struct ev_signal *w) |
1516 | { |
1540 | { |
1517 | #if EV_MULTIPLICITY |
1541 | #if EV_MULTIPLICITY |
1518 | assert (("signal watchers are only supported in the default loop", loop == default_loop)); |
1542 | assert (("signal watchers are only supported in the default loop", loop == ev_default_loop_ptr)); |
1519 | #endif |
1543 | #endif |
1520 | if (ev_is_active (w)) |
1544 | if (ev_is_active (w)) |
1521 | return; |
1545 | return; |
1522 | |
1546 | |
1523 | assert (("ev_signal_start called with illegal signal number", w->signum > 0)); |
1547 | assert (("ev_signal_start called with illegal signal number", w->signum > 0)); |
… | |
… | |
1556 | |
1580 | |
1557 | void |
1581 | void |
1558 | ev_child_start (EV_P_ struct ev_child *w) |
1582 | ev_child_start (EV_P_ struct ev_child *w) |
1559 | { |
1583 | { |
1560 | #if EV_MULTIPLICITY |
1584 | #if EV_MULTIPLICITY |
1561 | assert (("child watchers are only supported in the default loop", loop == default_loop)); |
1585 | assert (("child watchers are only supported in the default loop", loop == ev_default_loop_ptr)); |
1562 | #endif |
1586 | #endif |
1563 | if (ev_is_active (w)) |
1587 | if (ev_is_active (w)) |
1564 | return; |
1588 | return; |
1565 | |
1589 | |
1566 | ev_start (EV_A_ (W)w, 1); |
1590 | ev_start (EV_A_ (W)w, 1); |