… | |
… | |
810 | fd_intern (evpipe [0]); |
810 | fd_intern (evpipe [0]); |
811 | fd_intern (evpipe [1]); |
811 | fd_intern (evpipe [1]); |
812 | |
812 | |
813 | ev_io_set (&pipeev, evpipe [0], EV_READ); |
813 | ev_io_set (&pipeev, evpipe [0], EV_READ); |
814 | ev_io_start (EV_A_ &pipeev); |
814 | ev_io_start (EV_A_ &pipeev); |
815 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
815 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
816 | } |
816 | } |
817 | } |
817 | } |
818 | |
818 | |
819 | void inline_size |
819 | void inline_size |
820 | evpipe_write (EV_P_ int sig, int async) |
820 | evpipe_write (EV_P_ int sig, int async) |
821 | { |
821 | { |
822 | if (!(gotasync || gotsig)) |
822 | if (!(gotasync || gotsig)) |
823 | { |
823 | { |
824 | int old_errno = errno; |
824 | int old_errno = errno; /* save errno becaue write might clobber it */ |
825 | |
825 | |
826 | if (sig) gotsig = 1; |
826 | if (sig) gotsig = 1; |
827 | if (async) gotasync = 1; |
827 | if (async) gotasync = 1; |
828 | |
828 | |
829 | write (evpipe [1], &old_errno, 1); |
829 | write (evpipe [1], &old_errno, 1); |
|
|
830 | |
830 | errno = old_errno; |
831 | errno = old_errno; |
831 | } |
832 | } |
832 | } |
833 | } |
833 | |
834 | |
834 | static void |
835 | static void |
… | |
… | |
847 | for (signum = signalmax; signum--; ) |
848 | for (signum = signalmax; signum--; ) |
848 | if (signals [signum].gotsig) |
849 | if (signals [signum].gotsig) |
849 | ev_feed_signal_event (EV_A_ signum + 1); |
850 | ev_feed_signal_event (EV_A_ signum + 1); |
850 | } |
851 | } |
851 | |
852 | |
|
|
853 | #if EV_ASYNC_ENABLE |
852 | if (gotasync) |
854 | if (gotasync) |
853 | { |
855 | { |
854 | int i; |
856 | int i; |
855 | gotasync = 0; |
857 | gotasync = 0; |
856 | |
858 | |
… | |
… | |
859 | { |
861 | { |
860 | asyncs [i]->sent = 0; |
862 | asyncs [i]->sent = 0; |
861 | ev_feed_event (EV_A_ asyncs [i], EV_ASYNC); |
863 | ev_feed_event (EV_A_ asyncs [i], EV_ASYNC); |
862 | } |
864 | } |
863 | } |
865 | } |
|
|
866 | #endif |
864 | } |
867 | } |
865 | |
868 | |
866 | /*****************************************************************************/ |
869 | /*****************************************************************************/ |
867 | |
870 | |
868 | static void |
871 | static void |
… | |
… | |
1079 | if (!clock_gettime (CLOCK_MONOTONIC, &ts)) |
1082 | if (!clock_gettime (CLOCK_MONOTONIC, &ts)) |
1080 | have_monotonic = 1; |
1083 | have_monotonic = 1; |
1081 | } |
1084 | } |
1082 | #endif |
1085 | #endif |
1083 | |
1086 | |
1084 | ev_rt_now = ev_time (); |
1087 | ev_rt_now = ev_time (); |
1085 | mn_now = get_clock (); |
1088 | mn_now = get_clock (); |
1086 | now_floor = mn_now; |
1089 | now_floor = mn_now; |
1087 | rtmn_diff = ev_rt_now - mn_now; |
1090 | rtmn_diff = ev_rt_now - mn_now; |
1088 | |
1091 | |
1089 | io_blocktime = 0.; |
1092 | io_blocktime = 0.; |
1090 | timeout_blocktime = 0.; |
1093 | timeout_blocktime = 0.; |
|
|
1094 | backend = 0; |
|
|
1095 | backend_fd = -1; |
|
|
1096 | gotasync = 0; |
|
|
1097 | #if EV_USE_INOTIFY |
|
|
1098 | fs_fd = -2; |
|
|
1099 | #endif |
1091 | |
1100 | |
1092 | /* pid check not overridable via env */ |
1101 | /* pid check not overridable via env */ |
1093 | #ifndef _WIN32 |
1102 | #ifndef _WIN32 |
1094 | if (flags & EVFLAG_FORKCHECK) |
1103 | if (flags & EVFLAG_FORKCHECK) |
1095 | curpid = getpid (); |
1104 | curpid = getpid (); |
… | |
… | |
1100 | && getenv ("LIBEV_FLAGS")) |
1109 | && getenv ("LIBEV_FLAGS")) |
1101 | flags = atoi (getenv ("LIBEV_FLAGS")); |
1110 | flags = atoi (getenv ("LIBEV_FLAGS")); |
1102 | |
1111 | |
1103 | if (!(flags & 0x0000ffffUL)) |
1112 | if (!(flags & 0x0000ffffUL)) |
1104 | flags |= ev_recommended_backends (); |
1113 | flags |= ev_recommended_backends (); |
1105 | |
|
|
1106 | backend = 0; |
|
|
1107 | backend_fd = -1; |
|
|
1108 | #if EV_USE_INOTIFY |
|
|
1109 | fs_fd = -2; |
|
|
1110 | #endif |
|
|
1111 | |
1114 | |
1112 | #if EV_USE_PORT |
1115 | #if EV_USE_PORT |
1113 | if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); |
1116 | if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); |
1114 | #endif |
1117 | #endif |
1115 | #if EV_USE_KQUEUE |
1118 | #if EV_USE_KQUEUE |
… | |
… | |
1187 | #if EV_FORK_ENABLE |
1190 | #if EV_FORK_ENABLE |
1188 | array_free (fork, EMPTY); |
1191 | array_free (fork, EMPTY); |
1189 | #endif |
1192 | #endif |
1190 | array_free (prepare, EMPTY); |
1193 | array_free (prepare, EMPTY); |
1191 | array_free (check, EMPTY); |
1194 | array_free (check, EMPTY); |
|
|
1195 | #if EV_ASYNC_ENABLE |
|
|
1196 | array_free (async, EMPTY); |
|
|
1197 | #endif |
1192 | |
1198 | |
1193 | backend = 0; |
1199 | backend = 0; |
1194 | } |
1200 | } |
1195 | |
1201 | |
1196 | void inline_size infy_fork (EV_P); |
1202 | void inline_size infy_fork (EV_P); |