Marc Alexander Lehmann 8 years ago
parent
commit
d76a28e6bf
3 changed files with 30 additions and 18 deletions
  1. +1
    -0
      Changes
  2. +13
    -12
      ev.3
  3. +16
    -6
      ev.c

+ 1
- 0
Changes View File

@ -56,6 +56,7 @@ TODO: document portbaility requirements for atomic pointer access
- move orig_CFLAGS assignment to after AC_INIT, as newer autoconf
versions ignore it before
(https://bugzilla.redhat.com/show_bug.cgi?id=908096).
- add some untested android support.
4.11 Sat Feb 4 19:52:39 CET 2012
- INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as


+ 13
- 12
ev.3 View File

@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "LIBEV 3"
.TH LIBEV 3 "2012-11-13" "libev-4.11" "libev - high performance full featured event loop"
.TH LIBEV 3 "2013-02-18" "libev-4.11" "libev - high performance full featured event loop"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -689,7 +689,7 @@ course). While stopping, setting and starting an I/O watcher does never
cause an extra system call as with \f(CW\*(C`EVBACKEND_EPOLL\*(C'\fR, it still adds up to
two event changes per incident. Support for \f(CW\*(C`fork ()\*(C'\fR is very bad (you
might have to leak fd's on fork, but it's more sane than epoll) and it
drops fds silently in similarly hard-to-detect cases
drops fds silently in similarly hard-to-detect cases.
.Sp
This backend usually performs well under most conditions.
.Sp
@ -1510,8 +1510,8 @@ There are various watcher states mentioned throughout this manual \-
active, pending and so on. In this section these states and the rules to
transition between them will be described in more detail \- and while these
rules might look complicated, they usually do \*(L"the right thing\*(R".
.IP "initialiased" 4
.IX Item "initialiased"
.IP "initialised" 4
.IX Item "initialised"
Before a watcher can be registered with the event loop it has to be
initialised. This can be done with a call to \f(CW\*(C`ev_TYPE_init\*(C'\fR, or calls to
\&\f(CW\*(C`ev_init\*(C'\fR followed by the watcher-specific \f(CW\*(C`ev_TYPE_set\*(C'\fR function.
@ -2742,8 +2742,9 @@ its completion.
.IX Subsection "ev_stat - did the file attributes just change?"
This watches a file system path for attribute changes. That is, it calls
\&\f(CW\*(C`stat\*(C'\fR on that path in regular intervals (or when the \s-1OS\s0 says it changed)
and sees if it changed compared to the last time, invoking the callback if
it did.
and sees if it changed compared to the last time, invoking the callback
if it did. Starting the watcher \f(CW\*(C`stat\*(C'\fR's the file, so only changes that
happen after the watcher has been started will be reported.
.PP
The path does not need to exist: changing from \*(L"path exists\*(R" to \*(L"path does
not exist\*(R" is a status change like any other. The condition \*(L"path does not
@ -3318,8 +3319,8 @@ as applicable.
.IP "ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)" 4
.IX Item "ev_embed_init (ev_embed *, callback, struct ev_loop *embedded_loop)"
.PD 0
.IP "ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop)" 4
.IX Item "ev_embed_set (ev_embed *, callback, struct ev_loop *embedded_loop)"
.IP "ev_embed_set (ev_embed *, struct ev_loop *embedded_loop)" 4
.IX Item "ev_embed_set (ev_embed *, struct ev_loop *embedded_loop)"
.PD
Configures the watcher to embed the given loop, which must be
embeddable. If the callback is \f(CW0\fR, then \f(CW\*(C`ev_embed_sweep\*(C'\fR will be
@ -3783,9 +3784,9 @@ already been invoked.
A common way around all these issues is to make sure that
\&\f(CW\*(C`start_new_request\*(C'\fR \fIalways\fR returns before the callback is invoked. If
\&\f(CW\*(C`start_new_request\*(C'\fR immediately knows the result, it can artificially
delay invoking the callback by e.g. using a \f(CW\*(C`prepare\*(C'\fR or \f(CW\*(C`idle\*(C'\fR watcher
for example, or more sneakily, by reusing an existing (stopped) watcher
and pushing it into the pending queue:
delay invoking the callback by using a \f(CW\*(C`prepare\*(C'\fR or \f(CW\*(C`idle\*(C'\fR watcher for
example, or more sneakily, by reusing an existing (stopped) watcher and
pushing it into the pending queue:
.PP
.Vb 2
\& ev_set_cb (watcher, callback);
@ -3804,7 +3805,7 @@ This brings the problem of exiting \- a callback might want to finish the
main \f(CW\*(C`ev_run\*(C'\fR call, but not the nested one (e.g. user clicked \*(L"Quit\*(R", but
a modal \*(L"Are you sure?\*(R" dialog is still waiting), or just the nested one
and not the main one (e.g. user clocked \*(L"Ok\*(R" in a modal dialog), or some
other combination: In these cases, \f(CW\*(C`ev_break\*(C'\fR will not work alone.
other combination: In these cases, a simple \f(CW\*(C`ev_break\*(C'\fR will not work.
.PP
The solution is to maintain \*(L"break this loop\*(R" variable for each \f(CW\*(C`ev_run\*(C'\fR
invocation, and use a loop around \f(CW\*(C`ev_run\*(C'\fR until the condition is


+ 16
- 6
ev.c View File

@ -359,6 +359,22 @@
# define EV_HEAP_CACHE_AT EV_FEATURE_DATA
#endif
#ifdef ANDROID
/* supposedly, android doesn't typedef fd_mask */
# undef EV_USE_SELECT
# define EV_USE_SELECT 0
/* supposedly, we need to include syscall.h, not sys/syscall.h, so just disable */
# undef EV_USE_CLOCK_SYSCALL
# define EV_USE_CLOCK_SYSCALL 0
#endif
/* aix's poll.h seems to cause lots of trouble */
#ifdef _AIX
/* AIX has a completely broken poll.h header */
# undef EV_USE_POLL
# define EV_USE_POLL 0
#endif
/* on linux, we can use a (slow) syscall to avoid a dependency on pthread, */
/* which makes programs even slower. might work on other unices, too. */
#if EV_USE_CLOCK_SYSCALL
@ -375,12 +391,6 @@
/* this block fixes any misconfiguration where we know we run into trouble otherwise */
#ifdef _AIX
/* AIX has a completely broken poll.h header */
# undef EV_USE_POLL
# define EV_USE_POLL 0
#endif
#ifndef CLOCK_MONOTONIC
# undef EV_USE_MONOTONIC
# define EV_USE_MONOTONIC 0


Loading…
Cancel
Save