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

Comparing libev/ev.c (file contents):
Revision 1.208 by root, Fri Feb 1 13:22:48 2008 UTC vs.
Revision 1.211 by root, Tue Feb 19 17:09:28 2008 UTC

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
817 /* in case we received the signal before we had the chance of installing a handler */
818 ev_feed_event (EV_A_ &pipeev, 0);
816 } 819 }
817} 820}
818 821
819void inline_size 822void inline_size
820evpipe_write (EV_P_ int sig, int async) 823evpipe_write (EV_P_ int sig, int async)
821{ 824{
822 if (!(gotasync || gotsig)) 825 if (!(gotasync || gotsig))
823 { 826 {
824 int old_errno = errno; 827 int old_errno = errno; /* save errno becaue write might clobber it */
825 828
826 if (sig) gotsig = 1; 829 if (sig) gotsig = 1;
827 if (async) gotasync = 1; 830 if (async) gotasync = 1;
828 831
829 write (evpipe [1], &old_errno, 1); 832 write (evpipe [1], &old_errno, 1);
833
830 errno = old_errno; 834 errno = old_errno;
831 } 835 }
832} 836}
833 837
834static void 838static void
837 { 841 {
838 int dummy; 842 int dummy;
839 read (evpipe [0], &dummy, 1); 843 read (evpipe [0], &dummy, 1);
840 } 844 }
841 845
842 if (gotsig) 846 if (gotsig && ev_is_default_loop (EV_A))
843 { 847 {
844 int signum; 848 int signum;
845 gotsig = 0; 849 gotsig = 0;
846 850
847 for (signum = signalmax; signum--; ) 851 for (signum = signalmax; signum--; )
848 if (signals [signum].gotsig) 852 if (signals [signum].gotsig)
849 ev_feed_signal_event (EV_A_ signum + 1); 853 ev_feed_signal_event (EV_A_ signum + 1);
850 } 854 }
851 855
856#if EV_ASYNC_ENABLE
852 if (gotasync) 857 if (gotasync)
853 { 858 {
854 int i; 859 int i;
855 gotasync = 0; 860 gotasync = 0;
856 861
859 { 864 {
860 asyncs [i]->sent = 0; 865 asyncs [i]->sent = 0;
861 ev_feed_event (EV_A_ asyncs [i], EV_ASYNC); 866 ev_feed_event (EV_A_ asyncs [i], EV_ASYNC);
862 } 867 }
863 } 868 }
869#endif
864} 870}
865 871
866/*****************************************************************************/ 872/*****************************************************************************/
867 873
868static void 874static void
1079 if (!clock_gettime (CLOCK_MONOTONIC, &ts)) 1085 if (!clock_gettime (CLOCK_MONOTONIC, &ts))
1080 have_monotonic = 1; 1086 have_monotonic = 1;
1081 } 1087 }
1082#endif 1088#endif
1083 1089
1084 ev_rt_now = ev_time (); 1090 ev_rt_now = ev_time ();
1085 mn_now = get_clock (); 1091 mn_now = get_clock ();
1086 now_floor = mn_now; 1092 now_floor = mn_now;
1087 rtmn_diff = ev_rt_now - mn_now; 1093 rtmn_diff = ev_rt_now - mn_now;
1088 1094
1089 io_blocktime = 0.; 1095 io_blocktime = 0.;
1090 timeout_blocktime = 0.; 1096 timeout_blocktime = 0.;
1097 backend = 0;
1098 backend_fd = -1;
1099 gotasync = 0;
1100#if EV_USE_INOTIFY
1101 fs_fd = -2;
1102#endif
1091 1103
1092 /* pid check not overridable via env */ 1104 /* pid check not overridable via env */
1093#ifndef _WIN32 1105#ifndef _WIN32
1094 if (flags & EVFLAG_FORKCHECK) 1106 if (flags & EVFLAG_FORKCHECK)
1095 curpid = getpid (); 1107 curpid = getpid ();
1100 && getenv ("LIBEV_FLAGS")) 1112 && getenv ("LIBEV_FLAGS"))
1101 flags = atoi (getenv ("LIBEV_FLAGS")); 1113 flags = atoi (getenv ("LIBEV_FLAGS"));
1102 1114
1103 if (!(flags & 0x0000ffffUL)) 1115 if (!(flags & 0x0000ffffUL))
1104 flags |= ev_recommended_backends (); 1116 flags |= ev_recommended_backends ();
1105
1106 backend = 0;
1107 backend_fd = -1;
1108#if EV_USE_INOTIFY
1109 fs_fd = -2;
1110#endif
1111 1117
1112#if EV_USE_PORT 1118#if EV_USE_PORT
1113 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags); 1119 if (!backend && (flags & EVBACKEND_PORT )) backend = port_init (EV_A_ flags);
1114#endif 1120#endif
1115#if EV_USE_KQUEUE 1121#if EV_USE_KQUEUE
1187#if EV_FORK_ENABLE 1193#if EV_FORK_ENABLE
1188 array_free (fork, EMPTY); 1194 array_free (fork, EMPTY);
1189#endif 1195#endif
1190 array_free (prepare, EMPTY); 1196 array_free (prepare, EMPTY);
1191 array_free (check, EMPTY); 1197 array_free (check, EMPTY);
1198#if EV_ASYNC_ENABLE
1199 array_free (async, EMPTY);
1200#endif
1192 1201
1193 backend = 0; 1202 backend = 0;
1194} 1203}
1195 1204
1196void inline_size infy_fork (EV_P); 1205void inline_size infy_fork (EV_P);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines