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

Comparing libev/ev.c (file contents):
Revision 1.260 by root, Mon Sep 8 17:24:39 2008 UTC vs.
Revision 1.263 by root, Wed Oct 1 18:50:03 2008 UTC

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
2833 ev_loop (EV_A_ EVLOOP_NONBLOCK); 2838 ev_loop (EV_A_ EVLOOP_NONBLOCK);
2834 } 2839 }
2835 } 2840 }
2836} 2841}
2837 2842
2843static void
2844embed_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
2838#if 0 2855#if 0
2839static void 2856static void
2840embed_idle_cb (EV_P_ ev_idle *idle, int revents) 2857embed_idle_cb (EV_P_ ev_idle *idle, int revents)
2841{ 2858{
2842 ev_idle_stop (EV_A_ idle); 2859 ev_idle_stop (EV_A_ idle);
2862 2879
2863 ev_prepare_init (&w->prepare, embed_prepare_cb); 2880 ev_prepare_init (&w->prepare, embed_prepare_cb);
2864 ev_set_priority (&w->prepare, EV_MINPRI); 2881 ev_set_priority (&w->prepare, EV_MINPRI);
2865 ev_prepare_start (EV_A_ &w->prepare); 2882 ev_prepare_start (EV_A_ &w->prepare);
2866 2883
2884 ev_fork_init (&w->fork, embed_fork_cb);
2885 ev_fork_start (EV_A_ &w->fork);
2886
2867 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ 2887 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/
2868 2888
2869 ev_start (EV_A_ (W)w, 1); 2889 ev_start (EV_A_ (W)w, 1);
2870 2890
2871 EV_FREQUENT_CHECK; 2891 EV_FREQUENT_CHECK;
2878 if (expect_false (!ev_is_active (w))) 2898 if (expect_false (!ev_is_active (w)))
2879 return; 2899 return;
2880 2900
2881 EV_FREQUENT_CHECK; 2901 EV_FREQUENT_CHECK;
2882 2902
2883 ev_io_stop (EV_A_ &w->io); 2903 ev_io_stop (EV_A_ &w->io);
2884 ev_prepare_stop (EV_A_ &w->prepare); 2904 ev_prepare_stop (EV_A_ &w->prepare);
2885 2905 ev_fork_stop (EV_A_ &w->fork);
2886 ev_stop (EV_A_ (W)w);
2887 2906
2888 EV_FREQUENT_CHECK; 2907 EV_FREQUENT_CHECK;
2889} 2908}
2890#endif 2909#endif
2891 2910
2998} 3017}
2999 3018
3000static void 3019static void
3001once_cb_io (EV_P_ ev_io *w, int revents) 3020once_cb_io (EV_P_ ev_io *w, int revents)
3002{ 3021{
3003 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));
3004} 3025}
3005 3026
3006static void 3027static void
3007once_cb_to (EV_P_ ev_timer *w, int revents) 3028once_cb_to (EV_P_ ev_timer *w, int revents)
3008{ 3029{
3009 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));
3010} 3033}
3011 3034
3012void 3035void
3013ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg) 3036ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, void *arg), void *arg)
3014{ 3037{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines