summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--ev.c15
-rw-r--r--ev.pod13
3 files changed, 29 insertions, 1 deletions
diff --git a/Changes b/Changes
index 662572a..5c3771a 100644
--- a/Changes
+++ b/Changes
@@ -2,11 +2,11 @@ Revision history for libev, a high-performance and full-featured event loop.
TODO: ev_loop_wakeup
-TODO: EV_NO_THREADS/NO_SMP and/or EV_USE_PTHREADS or so. also document.
TODO: EV_STANDALONE == NO_HASSEL (do not use clock_gettime in ev_standalone)
4.11
- INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
was documented already, but not implemented in the repeating case.
+ - new compiletime symbols: EV_NO_SMP and EV_NO_THREADS.
- fix a race where the workaround against the epoll fork bugs
caused signals to not be handled anymore.
- correct backend_fudge for most backends, and implement a windows
diff --git a/ev.c b/ev.c
index c44327b..fe1b6ac 100644
--- a/ev.c
+++ b/ev.c
@@ -185,6 +185,17 @@
# include "ev.h"
#endif
+#if EV_NO_THREADS
+# undef EV_NO_SMP
+# define EV_NO_SMP 1
+# undef ECB_NO_THREADS
+# define ECB_NO_THREADS 1
+#endif
+#if EV_NO_SMP
+# undef EV_NO_SMP
+# define ECB_NO_SMP 1
+#endif
+
#ifndef _WIN32
# include <sys/time.h>
# include <sys/wait.h>
@@ -536,6 +547,10 @@ struct signalfd_siginfo
/* ECB_NO_THREADS - ecb is not used by multiple threads, ever */
/* ECB_NO_SMP - ecb might be used in multiple threads, but only on a single cpu */
+#if ECB_NO_THREADS
+# define ECB_NO_SMP 1
+#endif
+
#if ECB_NO_THREADS || ECB_NO_SMP
#define ECB_MEMORY_FENCE do { } while (0)
#endif
diff --git a/ev.pod b/ev.pod
index 9a4f187..2de0277 100644
--- a/ev.pod
+++ b/ev.pod
@@ -4506,6 +4506,19 @@ interface to speed up C<ev_stat> watchers. Its actual availability will
be detected at runtime. If undefined, it will be enabled if the headers
indicate GNU/Linux + Glibc 2.4 or newer, otherwise disabled.
+=item EV_NO_SMP
+
+If defined to be C<1>, libev will assume that memory is always coherent
+between threads, that is, threads can be used, but threads never run on
+different cpus (or different cpu cores). This reduces dependencies
+and makes libev faster.
+
+=item EV_NO_THREADS
+
+If defined to be C<1>, libev will assume that it will never be called
+from different threads, which is a stronger assumption than C<EV_NO_SMP>,
+above. This reduces dependencies and makes libev faster.
+
=item EV_ATOMIC_T
Libev requires an integer type (suitable for storing C<0> or C<1>) whose