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

Comparing libev/ev.pod (file contents):
Revision 1.172 by root, Wed Aug 6 07:01:25 2008 UTC vs.
Revision 1.175 by root, Mon Sep 8 16:36:14 2008 UTC

1134C<EVBACKEND_POLL>. 1134C<EVBACKEND_POLL>.
1135 1135
1136=head3 The special problem of SIGPIPE 1136=head3 The special problem of SIGPIPE
1137 1137
1138While not really specific to libev, it is easy to forget about SIGPIPE: 1138While not really specific to libev, it is easy to forget about SIGPIPE:
1139when reading from a pipe whose other end has been closed, your program 1139when writing to a pipe whose other end has been closed, your program gets
1140gets send a SIGPIPE, which, by default, aborts your program. For most 1140send a SIGPIPE, which, by default, aborts your program. For most programs
1141programs this is sensible behaviour, for daemons, this is usually 1141this is sensible behaviour, for daemons, this is usually undesirable.
1142undesirable.
1143 1142
1144So when you encounter spurious, unexplained daemon exits, make sure you 1143So when you encounter spurious, unexplained daemon exits, make sure you
1145ignore SIGPIPE (and maybe make sure you log the exit status of your daemon 1144ignore SIGPIPE (and maybe make sure you log the exit status of your daemon
1146somewhere, as that would have given you a big clue). 1145somewhere, as that would have given you a big clue).
1147 1146
1198times out after an hour and you reset your system clock to January last 1197times out after an hour and you reset your system clock to January last
1199year, it will still time out after (roughly) and hour. "Roughly" because 1198year, it will still time out after (roughly) and hour. "Roughly" because
1200detecting time jumps is hard, and some inaccuracies are unavoidable (the 1199detecting time jumps is hard, and some inaccuracies are unavoidable (the
1201monotonic clock option helps a lot here). 1200monotonic clock option helps a lot here).
1202 1201
1202The callback is guaranteed to be invoked only after its timeout has passed,
1203but if multiple timers become ready during the same loop iteration then
1204order of execution is undefined.
1205
1206=head3 The special problem of time updates
1207
1208Requesting the current time is a costly operation (it usually takes at
1209least two syscalls): EV therefore updates it's idea of the current time
1210only before and after C<ev_loop> polls for new events, which causes the
1211difference between C<ev_now ()> and C<ev_time ()>.
1212
1203The relative timeouts are calculated relative to the C<ev_now ()> 1213The relative timeouts are calculated relative to the C<ev_now ()>
1204time. This is usually the right thing as this timestamp refers to the time 1214time. This is usually the right thing as this timestamp refers to the time
1205of the event triggering whatever timeout you are modifying/starting. If 1215of the event triggering whatever timeout you are modifying/starting. If
1206you suspect event processing to be delayed and you I<need> to base the timeout 1216you suspect event processing to be delayed and you I<need> to base the
1207on the current time, use something like this to adjust for this: 1217timeout on the current time, use something like this to adjust for this:
1208 1218
1209 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.); 1219 ev_timer_set (&timer, after + ev_now () - ev_time (), 0.);
1210
1211The callback is guaranteed to be invoked only after its timeout has passed,
1212but if multiple timers become ready during the same loop iteration then
1213order of execution is undefined.
1214 1220
1215=head3 Watcher-Specific Functions and Data Members 1221=head3 Watcher-Specific Functions and Data Members
1216 1222
1217=over 4 1223=over 4
1218 1224
1569handler, you can override it easily by installing your own handler for 1575handler, you can override it easily by installing your own handler for
1570C<SIGCHLD> after initialising the default loop, and making sure the 1576C<SIGCHLD> after initialising the default loop, and making sure the
1571default loop never gets destroyed. You are encouraged, however, to use an 1577default loop never gets destroyed. You are encouraged, however, to use an
1572event-based approach to child reaping and thus use libev's support for 1578event-based approach to child reaping and thus use libev's support for
1573that, so other libev users can use C<ev_child> watchers freely. 1579that, so other libev users can use C<ev_child> watchers freely.
1580
1581=head3 Stopping the Child Watcher
1582
1583Currently, the child watcher never gets stopped, even when the
1584child terminates, so normally one needs to stop the watcher in the
1585callback. Future versions of libev might stop the watcher automatically
1586when a child exit is detected.
1574 1587
1575=head3 Watcher-Specific Functions and Data Members 1588=head3 Watcher-Specific Functions and Data Members
1576 1589
1577=over 4 1590=over 4
1578 1591

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines