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

Comparing libev/ev.c (file contents):
Revision 1.256 by root, Thu Jun 19 06:53:49 2008 UTC vs.
Revision 1.261 by root, Mon Sep 29 03:31:14 2008 UTC

565 struct timeval tv; 565 struct timeval tv;
566 566
567 tv.tv_sec = (time_t)delay; 567 tv.tv_sec = (time_t)delay;
568 tv.tv_usec = (long)((delay - (ev_tstamp)(tv.tv_sec)) * 1e6); 568 tv.tv_usec = (long)((delay - (ev_tstamp)(tv.tv_sec)) * 1e6);
569 569
570 /* here we rely on sys/time.h + sys/types.h + unistd.h providing select */
571 /* somehting nto guaranteed by newer posix versions, but guaranteed */
572 /* by older ones */
570 select (0, 0, 0, 0, &tv); 573 select (0, 0, 0, 0, &tv);
571#endif 574#endif
572 } 575 }
573} 576}
574 577
1508{ 1511{
1509 postfork = 1; /* must be in line with ev_default_fork */ 1512 postfork = 1; /* must be in line with ev_default_fork */
1510} 1513}
1511 1514
1512#if EV_VERIFY 1515#if EV_VERIFY
1513void noinline 1516static void noinline
1514verify_watcher (EV_P_ W w) 1517verify_watcher (EV_P_ W w)
1515{ 1518{
1516 assert (("watcher has invalid priority", ABSPRI (w) >= 0 && ABSPRI (w) < NUMPRI)); 1519 assert (("watcher has invalid priority", ABSPRI (w) >= 0 && ABSPRI (w) < NUMPRI));
1517 1520
1518 if (w->pending) 1521 if (w->pending)
1904 1907
1905void 1908void
1906ev_unref (EV_P) 1909ev_unref (EV_P)
1907{ 1910{
1908 --activecnt; 1911 --activecnt;
1912}
1913
1914void
1915ev_now_update (EV_P)
1916{
1917 time_update (EV_A_ 1e100);
1909} 1918}
1910 1919
1911static int loop_done; 1920static int loop_done;
1912 1921
1913void 1922void
2824 ev_loop (EV_A_ EVLOOP_NONBLOCK); 2833 ev_loop (EV_A_ EVLOOP_NONBLOCK);
2825 } 2834 }
2826 } 2835 }
2827} 2836}
2828 2837
2838static void
2839embed_fork_cb (EV_P_ ev_fork *fork_w, int revents)
2840{
2841 ev_embed *w = (ev_embed *)(((char *)fork_w) - offsetof (ev_embed, fork));
2842
2843 {
2844 struct ev_loop *loop = w->other;
2845
2846 ev_loop_fork (EV_A);
2847 }
2848}
2849
2829#if 0 2850#if 0
2830static void 2851static void
2831embed_idle_cb (EV_P_ ev_idle *idle, int revents) 2852embed_idle_cb (EV_P_ ev_idle *idle, int revents)
2832{ 2853{
2833 ev_idle_stop (EV_A_ idle); 2854 ev_idle_stop (EV_A_ idle);
2853 2874
2854 ev_prepare_init (&w->prepare, embed_prepare_cb); 2875 ev_prepare_init (&w->prepare, embed_prepare_cb);
2855 ev_set_priority (&w->prepare, EV_MINPRI); 2876 ev_set_priority (&w->prepare, EV_MINPRI);
2856 ev_prepare_start (EV_A_ &w->prepare); 2877 ev_prepare_start (EV_A_ &w->prepare);
2857 2878
2879 ev_fork_init (&w->fork, embed_fork_cb);
2880 ev_fork_start (EV_A_ &w->fork);
2881
2858 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/ 2882 /*ev_idle_init (&w->idle, e,bed_idle_cb);*/
2859 2883
2860 ev_start (EV_A_ (W)w, 1); 2884 ev_start (EV_A_ (W)w, 1);
2861 2885
2862 EV_FREQUENT_CHECK; 2886 EV_FREQUENT_CHECK;
2869 if (expect_false (!ev_is_active (w))) 2893 if (expect_false (!ev_is_active (w)))
2870 return; 2894 return;
2871 2895
2872 EV_FREQUENT_CHECK; 2896 EV_FREQUENT_CHECK;
2873 2897
2874 ev_io_stop (EV_A_ &w->io); 2898 ev_io_stop (EV_A_ &w->io);
2875 ev_prepare_stop (EV_A_ &w->prepare); 2899 ev_prepare_stop (EV_A_ &w->prepare);
2876 2900 ev_fork_stop (EV_A_ &w->fork);
2877 ev_stop (EV_A_ (W)w);
2878 2901
2879 EV_FREQUENT_CHECK; 2902 EV_FREQUENT_CHECK;
2880} 2903}
2881#endif 2904#endif
2882 2905
2979once_cb (EV_P_ struct ev_once *once, int revents) 3002once_cb (EV_P_ struct ev_once *once, int revents)
2980{ 3003{
2981 void (*cb)(int revents, void *arg) = once->cb; 3004 void (*cb)(int revents, void *arg) = once->cb;
2982 void *arg = once->arg; 3005 void *arg = once->arg;
2983 3006
2984 ev_io_stop (EV_A_ &once->io); 3007 ev_io_stop (EV_A_ &once->io);
2985 ev_timer_stop (EV_A_ &once->to); 3008 ev_timer_stop (EV_A_ &once->to);
2986 ev_free (once); 3009 ev_free (once);
2987 3010
2988 cb (revents, arg); 3011 cb (revents, arg);
2989} 3012}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines