]> rtime.felk.cvut.cz Git - sojka/libev.git/commitdiff
*** empty log message ***
authorMarc Alexander Lehmann <libev@schmorp.de>
Sat, 4 Feb 2012 17:57:55 +0000 (17:57 +0000)
committerMarc Alexander Lehmann <libev@schmorp.de>
Sat, 4 Feb 2012 17:57:55 +0000 (17:57 +0000)
Changes
ev.c
ev.pod

diff --git a/Changes b/Changes
index 662572ab6645d4302a4b862af3a28f699738a435..5c3771acbeba0e37d090fbb3066049a605e04f18 100644 (file)
--- 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 c44327b3a2546e26087cb48420c24afa4210e568..fe1b6ac86c182c2edad537f39a91bce379565749 100644 (file)
--- a/ev.c
+++ b/ev.c
 # 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 9a4f1871cf0c7024cb3bdd1cf59b89426a8ded9e..2de0277c414e87c89f06c0fe248b5a709f12dd3f 100644 (file)
--- 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