]> rtime.felk.cvut.cz Git - sojka/libev.git/commitdiff
*** empty log message ***
authorMarc Alexander Lehmann <libev@schmorp.de>
Tue, 1 May 2012 22:01:40 +0000 (22:01 +0000)
committerMarc Alexander Lehmann <libev@schmorp.de>
Tue, 1 May 2012 22:01:40 +0000 (22:01 +0000)
Changes
ev.c

diff --git a/Changes b/Changes
index a4ea069053b4742390436783e48646e71172e545..3b41960ff34f7fba71706051c3619ce997b36694 100644 (file)
--- a/Changes
+++ b/Changes
@@ -13,6 +13,8 @@ TODO: assert on fd watcher linked list pointing to itself
        - fix event_base_loop return code, add event_get_callback, event_base_new,
           event_base_get_method calls to improve libevent 1.x emulation and add
           some libevent 2.x funcitonality (based on a patch by Jeff Davey).
+        - add more memory fences to fix a bug reported by Jeff Davey. Better
+          be overfenced than underprotected.
        - ev_run now returns a boolean status (true meaning watchers are
           still active).
        - ev_once: undef EV_ERROR in ev_kqueue.c, to avoid clashing with
diff --git a/ev.c b/ev.c
index 449556d4e6c79ec133ce996c481ee8722bdab379..e24ed6fdb845ffda8dc616df4de0499bff425025 100644 (file)
--- a/ev.c
+++ b/ev.c
@@ -1846,6 +1846,8 @@ evpipe_init (EV_P)
 inline_speed void
 evpipe_write (EV_P_ EV_ATOMIC_T *flag)
 {
+  ECB_MEMORY_FENCE; /* push out the write before this function was called, acquire flag */
+
   if (expect_true (*flag))
     return;
 
@@ -1914,11 +1916,15 @@ pipecb (EV_P_ ev_io *iow, int revents)
 
   pipe_write_skipped = 0;
 
+  ECB_MEMORY_FENCE; /* push out skipped, acquire flags */
+
 #if EV_SIGNAL_ENABLE
   if (sig_pending)
     {
       sig_pending = 0;
 
+      ECB_MEMORY_FENCE_RELEASE;
+
       for (i = EV_NSIG - 1; i--; )
         if (expect_false (signals [i].pending))
           ev_feed_signal_event (EV_A_ i + 1);
@@ -1930,6 +1936,8 @@ pipecb (EV_P_ ev_io *iow, int revents)
     {
       async_pending = 0;
 
+      ECB_MEMORY_FENCE_RELEASE;
+
       for (i = asynccnt; i--; )
         if (asyncs [i]->sent)
           {