summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ev.352
1 files changed, 49 insertions, 3 deletions
diff --git a/ev.3 b/ev.3
index 9bef0a5..5c8444b 100644
--- a/ev.3
+++ b/ev.3
@@ -132,7 +132,7 @@
.\" ========================================================================
.\"
.IX Title "EV 1"
-.TH EV 1 "2008-03-13" "perl v5.10.0" "User Contributed Perl Documentation"
+.TH EV 1 "2008-04-02" "perl v5.10.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -406,6 +406,10 @@ flags. If that is troubling you, check \f(CW\*(C`ev_backend ()\*(C'\fR afterward
If you don't know what event loop to use, use the one returned from this
function.
.Sp
+Note that this function is \fInot\fR thread-safe, so if you want to use it
+from multiple threads, you have to lock (note also that this is unlikely,
+as loops cannot bes hared easily between threads anyway).
+.Sp
The default loop is the only loop that can handle \f(CW\*(C`ev_signal\*(C'\fR and
\&\f(CW\*(C`ev_child\*(C'\fR watchers, and to do this, it always registers a handler
for \f(CW\*(C`SIGCHLD\*(C'\fR. If this is a problem for your app you can either
@@ -602,6 +606,10 @@ always distinct from the default loop. Unlike the default loop, it cannot
handle signal and child watchers, and attempts to do so will be greeted by
undefined behaviour (or a failed assertion if assertions are enabled).
.Sp
+Note that this function \fIis\fR thread-safe, and the recommended way to use
+libev with threads is indeed to create one loop per thread, and using the
+default loop in the \*(L"main\*(R" or \*(L"initial\*(R" thread.
+.Sp
Example: Try to create a event loop that uses epoll and nothing else.
.Sp
.Vb 3
@@ -1221,6 +1229,19 @@ To support fork in your programs, you either have to call
enable \f(CW\*(C`EVFLAG_FORKCHECK\*(C'\fR, or resort to \f(CW\*(C`EVBACKEND_SELECT\*(C'\fR or
\&\f(CW\*(C`EVBACKEND_POLL\*(C'\fR.
.PP
+\fIThe special problem of \s-1SIGPIPE\s0\fR
+.IX Subsection "The special problem of SIGPIPE"
+.PP
+While not really specific to libev, it is easy to forget about \s-1SIGPIPE:\s0
+when reading from a pipe whose other end has been closed, your program
+gets send a \s-1SIGPIPE\s0, which, by default, aborts your program. For most
+programs this is sensible behaviour, for daemons, this is usually
+undesirable.
+.PP
+So when you encounter spurious, unexplained daemon exits, make sure you
+ignore \s-1SIGPIPE\s0 (and maybe make sure you log the exit status of your daemon
+somewhere, as that would have given you a big clue).
+.PP
\fIWatcher-Specific Functions\fR
.IX Subsection "Watcher-Specific Functions"
.IP "ev_io_init (ev_io *, callback, int fd, int events)" 4
@@ -1738,6 +1759,18 @@ to fall back to regular polling again even with inotify, but changes are
usually detected immediately, and if the file exists there will be no
polling.
.PP
+\fI\s-1ABI\s0 Issues (Largefile Support)\fR
+.IX Subsection "ABI Issues (Largefile Support)"
+.PP
+Libev by default (unless the user overrides this) uses the default
+compilation environment, which means that on systems with optionally
+disabled large file support, you get the 32 bit version of the stat
+structure. When using the library from programs that change the \s-1ABI\s0 to
+use 64 bit file offsets the programs will fail. In that case you have to
+compile libev with the same flags to get binary compatibility. This is
+obviously the case with any flags that change the \s-1ABI\s0, but the problem is
+most noticably with ev_stat and largefile support.
+.PP
\fIInotify\fR
.IX Subsection "Inotify"
.PP
@@ -2385,6 +2418,19 @@ section below on what exactly this means).
This call incurs the overhead of a syscall only once per loop iteration,
so while the overhead might be noticable, it doesn't apply to repeated
calls to \f(CW\*(C`ev_async_send\*(C'\fR.
+.IP "bool = ev_async_pending (ev_async *)" 4
+.IX Item "bool = ev_async_pending (ev_async *)"
+Returns a non-zero value when \f(CW\*(C`ev_async_send\*(C'\fR has been called on the
+watcher but the event has not yet been processed (or even noted) by the
+event loop.
+.Sp
+\&\f(CW\*(C`ev_async_send\*(C'\fR sets a flag in the watcher and wakes up the loop. When
+the loop iterates next and checks for the watcher to have become active,
+it will reset the flag again. \f(CW\*(C`ev_async_pending\*(C'\fR can be used to very
+quickly check wether invoking the loop might be a good idea.
+.Sp
+Not that this does \fInot\fR check wether the watcher itself is pending, only
+wether it has been requested to make this watcher pending.
.SH "OTHER FUNCTIONS"
.IX Header "OTHER FUNCTIONS"
There are some other functions of possible interest. Described. Here. Now.
@@ -3225,6 +3271,6 @@ Marc Lehmann <libev@schmorp.de>.
.SH "POD ERRORS"
.IX Header "POD ERRORS"
Hey! \fBThe above document had some coding errors, which are explained below:\fR
-.IP "Around line 2951:" 4
-.IX Item "Around line 2951:"
+.IP "Around line 2996:" 4
+.IX Item "Around line 2996:"
You forgot a '=back' before '=head2'