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

Comparing libev/ev.c (file contents):
Revision 1.211 by root, Tue Feb 19 17:09:28 2008 UTC vs.
Revision 1.213 by root, Tue Feb 19 19:13:50 2008 UTC

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); /* 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);
819 } 816 }
820} 817}
821 818
822void inline_size 819void inline_size
823evpipe_write (EV_P_ int sig, int async) 820evpipe_write (EV_P_ int sig, int async)
824{ 821{
825 if (!(gotasync || gotsig)) 822 int sent = gotasync || gotsig;
823
824 if (sig) gotsig = 1;
825 if (async) gotasync = 1;
826
827 if (!sent)
826 { 828 {
827 int old_errno = errno; /* save errno becaue write might clobber it */ 829 int old_errno = errno; /* save errno becaue write might clobber it */
828
829 if (sig) gotsig = 1;
830 if (async) gotasync = 1;
831
832 write (evpipe [1], &old_errno, 1); 830 write (evpipe [1], &old_errno, 1);
833
834 errno = old_errno; 831 errno = old_errno;
835 } 832 }
836} 833}
837 834
838static void 835static void
1221#endif 1218#endif
1222 1219
1223 if (ev_is_active (&pipeev)) 1220 if (ev_is_active (&pipeev))
1224 { 1221 {
1225 /* this "locks" the handlers against writing to the pipe */ 1222 /* this "locks" the handlers against writing to the pipe */
1223 /* while we modify the fd vars */
1224 gotsig = 1;
1225#if EV_ASYNC_ENABLE
1226 gotsig = gotasync = 1; 1226 gotasync = 1;
1227#endif
1227 1228
1228 ev_ref (EV_A); 1229 ev_ref (EV_A);
1229 ev_io_stop (EV_A_ &pipeev); 1230 ev_io_stop (EV_A_ &pipeev);
1230 close (evpipe [0]); 1231 close (evpipe [0]);
1231 close (evpipe [1]); 1232 close (evpipe [1]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines