[libev] Is ev_async_send() a seq. cst. barrier?

Andrey Pokrovskiy wonder.mice at gmail.com
Mon Apr 6 22:42:01 CEST 2015


Hi,

Is it a correct assumption that ev_async_send() is a sequential
consistency barrier?

>From source code it doesn't seem so.
ev_async_send() publishes event with
    w->sent = 1;
Where "sent" is a volatile sig_atomic_t which doesn't impose any
ordering (afaik).

Consider:
    (1) last_event = event; // or __atomic_store_n(&last_event, event,
__ATOMIC_RELEASE);
    (2) ev_async_send(ev_event);
I think it's possible that "w->sent = 1" in (2) can be moved (observed
by other threads) before (1).

Could anybody comment on this please?



More information about the libev mailing list