summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2013-02-18 03:20:28 +0000
committerroot <root>2013-02-18 03:20:28 +0000
commitf6d4687f22ce23e0008df90473baa6657677fcc2 (patch)
treedf47b1736282d33319563fc13e5c9be9e5d5019f
parentf703e97b4a4e2c7010a338e5ac289acaf18bb536 (diff)
http://laurentdesegur.wordpress.com/2011/10/07/building-libev-and-libeio-with-android-ndk/
-rw-r--r--Changes1
-rw-r--r--ev.325
-rw-r--r--ev.c22
3 files changed, 30 insertions, 18 deletions
diff --git a/Changes b/Changes
index c1d2cae..f5d17d3 100644
--- a/Changes
+++ b/Changes
@@ -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
diff --git a/ev.3 b/ev.3
index 5a87f08..ed3980f 100644
--- a/ev.3
+++ b/ev.3
@@ -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
diff --git a/ev.c b/ev.c
index 8908b5e..e9850a2 100644
--- a/ev.c
+++ b/ev.c
@@ -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