summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorroot <root>2012-05-31 15:47:59 +0000
committerroot <root>2012-05-31 15:47:59 +0000
commit168e3158816f954ee1f7b6b8195e422f8afb83c5 (patch)
treed076259c5aaefbc4489c664b35071dab8c5af363
parent64d1ffa977e30bf58c75ec0afce1f5cdc1c67aa9 (diff)
*** empty log message ***
-rw-r--r--ev.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/ev.c b/ev.c
index 58ee210..c9198ca 100644
--- a/ev.c
+++ b/ev.c
@@ -561,7 +561,6 @@ struct signalfd_siginfo
#define ECB_C99 (__STDC_VERSION__ >= 199901L)
#define ECB_C11 (__STDC_VERSION__ >= 201112L)
#define ECB_CPP (__cplusplus+0)
-#define ECB_CPP98 (__cplusplus >= 199711L)
#define ECB_CPP11 (__cplusplus >= 201103L)
/*****************************************************************************/
@@ -616,10 +615,10 @@ struct signalfd_siginfo
#ifndef ECB_MEMORY_FENCE
#if ECB_GCC_VERSION(4,7)
- /* see comment below about the C11 memory model. in short - avoid */
+ /* see comment below (stdatomic.h) about the C11 memory model. */
#define ECB_MEMORY_FENCE __atomic_thread_fence (__ATOMIC_SEQ_CST)
#elif defined __clang && __has_feature (cxx_atomic)
- /* see above */
+ /* see comment below (stdatomic.h) about the C11 memory model. */
#define ECB_MEMORY_FENCE __c11_atomic_thread_fence (__ATOMIC_SEQ_CST)
#elif ECB_GCC_VERSION(4,4) || defined __INTEL_COMPILER || defined __clang__
#define ECB_MEMORY_FENCE __sync_synchronize ()
@@ -646,8 +645,12 @@ struct signalfd_siginfo
/* we assume that these memory fences work on all variables/all memory accesses, */
/* not just C11 atomics and atomic accesses */
#include <stdatomic.h>
- /* unfortunately, the C11 memory model seems to be very limited, and unable to express */
- /* simple barrier semantics. That means we need to take out thor's hammer. */
+ /* Unfortunately, neither gcc 4.7 nor clang 3.1 generate any instructions for */
+ /* any fence other than seq_cst, which isn't very efficient for us. */
+ /* Why that is, we don't know - either the C11 memory model is quite useless */
+ /* for most usages, or gcc and clang have a bug */
+ /* I *currently* lean towards the latter, and inefficiently implement */
+ /* all three of ecb's fences as a seq_cst fence */
#define ECB_MEMORY_FENCE atomic_thread_fence (memory_order_seq_cst)
#endif
#endif
@@ -3137,7 +3140,7 @@ ev_run (EV_P_ int flags)
pipe_write_wanted = 0; /* just an optimisation, no fence needed */
- MEMORY_FENCE_ACQUIRE;
+ ECB_MEMORY_FENCE_ACQUIRE;
if (pipe_write_skipped)
{
assert (("libev: pipe_w not active, but pipe not written", ev_is_active (&pipe_w)));