aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2016-05-31 20:20:03 +0200
committerSverker Eriksson <[email protected]>2016-05-31 20:20:03 +0200
commit7321e2a3cde97342f966193cb69e682596e36536 (patch)
tree4d4545e4ae39296cd0f5761755f5626d0c569fbe /erts/emulator
parent14210c8cf4f8088831e0d7b4a1b66b7eb639ac4b (diff)
parent24da853729d1f02a8c8a3aec1f0c992e00b5ca3f (diff)
downloadotp-7321e2a3cde97342f966193cb69e682596e36536.tar.gz
otp-7321e2a3cde97342f966193cb69e682596e36536.tar.bz2
otp-7321e2a3cde97342f966193cb69e682596e36536.zip
Merge branch 'sverker/windows-poller-wakeup-race/OTP-13634'
Diffstat (limited to 'erts/emulator')
-rw-r--r--erts/emulator/sys/win32/erl_poll.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/erts/emulator/sys/win32/erl_poll.c b/erts/emulator/sys/win32/erl_poll.c
index 94f3840b5f..f23c7ab03d 100644
--- a/erts/emulator/sys/win32/erl_poll.c
+++ b/erts/emulator/sys/win32/erl_poll.c
@@ -424,7 +424,7 @@ static ERTS_INLINE int
wakeup_cause(ErtsPollSet ps)
{
int res;
- erts_aint32_t wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state);
+ erts_aint32_t wakeup_state = erts_atomic32_read_acqb(&ps->wakeup_state);
switch (wakeup_state) {
case ERTS_POLL_WOKEN_IO_READY:
res = 0;
@@ -487,9 +487,8 @@ wake_poller(ErtsPollSet ps, int io_ready)
{
erts_aint32_t wakeup_state;
if (io_ready) {
- /* We may set the event multiple times. This is, however, harmless. */
- wakeup_state = erts_atomic32_read_nob(&ps->wakeup_state);
- erts_atomic32_set_relb(&ps->wakeup_state, ERTS_POLL_WOKEN_IO_READY);
+ wakeup_state = erts_atomic32_xchg_relb(&ps->wakeup_state,
+ ERTS_POLL_WOKEN_IO_READY);
}
else {
ERTS_THR_MEMORY_BARRIER;