… | |
… | |
287 | # endif |
287 | # endif |
288 | #endif |
288 | #endif |
289 | |
289 | |
290 | #if EV_USE_INOTIFY |
290 | #if EV_USE_INOTIFY |
291 | # include <sys/inotify.h> |
291 | # include <sys/inotify.h> |
|
|
292 | /* some very old inotify.h headers don't have IN_DONT_FOLLOW */ |
|
|
293 | # ifndef IN_DONT_FOLLOW |
|
|
294 | # undef EV_USE_INOTIFY |
|
|
295 | # define EV_USE_INOTIFY 0 |
|
|
296 | # endif |
292 | #endif |
297 | #endif |
293 | |
298 | |
294 | #if EV_SELECT_IS_WINSOCKET |
299 | #if EV_SELECT_IS_WINSOCKET |
295 | # include <winsock.h> |
300 | # include <winsock.h> |
296 | #endif |
301 | #endif |
… | |
… | |
1907 | |
1912 | |
1908 | void |
1913 | void |
1909 | ev_unref (EV_P) |
1914 | ev_unref (EV_P) |
1910 | { |
1915 | { |
1911 | --activecnt; |
1916 | --activecnt; |
|
|
1917 | } |
|
|
1918 | |
|
|
1919 | void |
|
|
1920 | ev_now_update (EV_P) |
|
|
1921 | { |
|
|
1922 | time_update (EV_A_ 1e100); |
1912 | } |
1923 | } |
1913 | |
1924 | |
1914 | static int loop_done; |
1925 | static int loop_done; |
1915 | |
1926 | |
1916 | void |
1927 | void |
… | |
… | |
2827 | ev_loop (EV_A_ EVLOOP_NONBLOCK); |
2838 | ev_loop (EV_A_ EVLOOP_NONBLOCK); |
2828 | } |
2839 | } |
2829 | } |
2840 | } |
2830 | } |
2841 | } |
2831 | |
2842 | |
|
|
2843 | static void |
|
|
2844 | embed_fork_cb (EV_P_ ev_fork *fork_w, int revents) |
|
|
2845 | { |
|
|
2846 | ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork)); |
|
|
2847 | |
|
|
2848 | { |
|
|
2849 | struct ev_loop *loop = w->other; |
|
|
2850 | |
|
|
2851 | ev_loop_fork (EV_A); |
|
|
2852 | } |
|
|
2853 | } |
|
|
2854 | |
2832 | #if 0 |
2855 | #if 0 |
2833 | static void |
2856 | static void |
2834 | embed_idle_cb (EV_P_ ev_idle *idle, int revents) |
2857 | embed_idle_cb (EV_P_ ev_idle *idle, int revents) |
2835 | { |
2858 | { |
2836 | ev_idle_stop (EV_A_ idle); |
2859 | ev_idle_stop (EV_A_ idle); |
… | |
… | |
2856 | |
2879 | |
2857 | ev_prepare_init (&w->prepare, embed_prepare_cb); |
2880 | ev_prepare_init (&w->prepare, embed_prepare_cb); |
2858 | ev_set_priority (&w->prepare, EV_MINPRI); |
2881 | ev_set_priority (&w->prepare, EV_MINPRI); |
2859 | ev_prepare_start (EV_A_ &w->prepare); |
2882 | ev_prepare_start (EV_A_ &w->prepare); |
2860 | |
2883 | |
|
|
2884 | ev_fork_init (&w->fork, embed_fork_cb); |
|
|
2885 | ev_fork_start (EV_A_ &w->fork); |
|
|
2886 | |
2861 | /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ |
2887 | /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ |
2862 | |
2888 | |
2863 | ev_start (EV_A_ (W)w, 1); |
2889 | ev_start (EV_A_ (W)w, 1); |
2864 | |
2890 | |
2865 | EV_FREQUENT_CHECK; |
2891 | EV_FREQUENT_CHECK; |
… | |
… | |
2872 | if (expect_false (!ev_is_active (w))) |
2898 | if (expect_false (!ev_is_active (w))) |
2873 | return; |
2899 | return; |
2874 | |
2900 | |
2875 | EV_FREQUENT_CHECK; |
2901 | EV_FREQUENT_CHECK; |
2876 | |
2902 | |
2877 | ev_io_stop (EV_A_ &w->io); |
2903 | ev_io_stop (EV_A_ &w->io); |
2878 | ev_prepare_stop (EV_A_ &w->prepare); |
2904 | ev_prepare_stop (EV_A_ &w->prepare); |
2879 | |
2905 | ev_fork_stop (EV_A_ &w->fork); |
2880 | ev_stop (EV_A_ (W)w); |
|
|
2881 | |
2906 | |
2882 | EV_FREQUENT_CHECK; |
2907 | EV_FREQUENT_CHECK; |
2883 | } |
2908 | } |
2884 | #endif |
2909 | #endif |
2885 | |
2910 | |
… | |
… | |
2992 | } |
3017 | } |
2993 | |
3018 | |
2994 | static void |
3019 | static void |
2995 | once_cb_io (EV_P_ ev_io *w, int revents) |
3020 | once_cb_io (EV_P_ ev_io *w, int revents) |
2996 | { |
3021 | { |
2997 | once_cb (EV_A_ (struct ev_once *)(((char *)w) - offsetof (struct ev_once, io)), revents); |
3022 | struct ev_once *once = (struct ev_once *)(((char *)w) - offsetof (struct ev_once, io)); |
|
|
3023 | |
|
|
3024 | once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->to)); |
2998 | } |
3025 | } |
2999 | |
3026 | |
3000 | static void |
3027 | static void |
3001 | once_cb_to (EV_P_ ev_timer *w, int revents) |
3028 | once_cb_to (EV_P_ ev_timer *w, int revents) |
3002 | { |
3029 | { |
3003 | once_cb (EV_A_ (struct ev_once *)(((char *)w) - offsetof (struct ev_once, to)), revents); |
3030 | struct ev_once *once = (struct ev_once *)(((char *)w) - offsetof (struct ev_once, to)); |
|
|
3031 | |
|
|
3032 | once_cb (EV_A_ once, revents | ev_clear_pending (EV_A_ &once->io)); |
3004 | } |
3033 | } |
3005 | |
3034 | |
3006 | void |
3035 | void |
3007 | ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) |
3036 | ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) |
3008 | { |
3037 | { |