summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes2
-rw-r--r--ev.c8
2 files changed, 10 insertions, 0 deletions
diff --git a/Changes b/Changes
index a4ea069..3b41960 100644
--- 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 449556d..e24ed6f 100644
--- 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)
{