From 8bd5d2a25946234c4a1fe548d2422e45a7525b76 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 4 Feb 2012 17:57:55 +0000 Subject: *** empty log message *** --- Changes | 2 +- ev.c | 15 +++++++++++++++ ev.pod | 13 +++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) 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 # include @@ -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 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, +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 -- cgit v1.2.3