aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/sys
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2011-03-10 14:29:59 +0100
committerRickard Green <[email protected]>2011-03-10 14:29:59 +0100
commit0213def22b5ab6f145a5529f9bbef0d26124abaf (patch)
tree5c47bce2d933052236bc7b9f9b4253d2489f3557 /erts/emulator/sys
parent839e24abdcc3e5a16ac78eb45e09736370e596fe (diff)
parenta37ee29884eaaf8b177cec19821159c938ddf6ff (diff)
downloadotp-0213def22b5ab6f145a5529f9bbef0d26124abaf.tar.gz
otp-0213def22b5ab6f145a5529f9bbef0d26124abaf.tar.bz2
otp-0213def22b5ab6f145a5529f9bbef0d26124abaf.zip
Merge branch 'rickard/scheduler-wait/OTP-9105' into dev
* rickard/scheduler-wait/OTP-9105: The emulator could get into a state where it didn't check for I/O.
Diffstat (limited to 'erts/emulator/sys')
-rw-r--r--erts/emulator/sys/common/erl_poll.c1
-rw-r--r--erts/emulator/sys/win32/erl_poll.c8
2 files changed, 7 insertions, 2 deletions
diff --git a/erts/emulator/sys/common/erl_poll.c b/erts/emulator/sys/common/erl_poll.c
index 77ac2de5f6..3ae5b8d747 100644
--- a/erts/emulator/sys/common/erl_poll.c
+++ b/erts/emulator/sys/common/erl_poll.c
@@ -347,6 +347,7 @@ reset_wakeup_state(ErtsPollSet ps)
{
#ifdef ERTS_SMP
erts_atomic32_set(&ps->wakeup_state, ERTS_POLL_NOT_WOKEN);
+ ERTS_THR_MEMORY_BARRIER;
#elif ERTS_POLL_ASYNC_INTERRUPT_SUPPORT
ps->wakeup_state = 0;
#endif
diff --git a/erts/emulator/sys/win32/erl_poll.c b/erts/emulator/sys/win32/erl_poll.c
index 1f2877b682..7662f190ef 100644
--- a/erts/emulator/sys/win32/erl_poll.c
+++ b/erts/emulator/sys/win32/erl_poll.c
@@ -452,12 +452,15 @@ poll_wait_timeout(ErtsPollSet ps, SysTimeval *tvp)
static ERTS_INLINE void
wake_poller(ErtsPollSet ps, int io_ready)
{
- erts_aint32_t wakeup_state = erts_atomic32_read(&ps->wakeup_state);
+ erts_aint32_t wakeup_state;
if (io_ready) {
/* We may set the event multiple times. This is, however, harmless. */
- erts_atomic32_set(&ps->wakeup_state, ERTS_POLL_WOKEN_IO_READY);
+ wakeup_state = erts_atomic32_read(&ps->wakeup_state);
+ erts_atomic32_set_relb(&ps->wakeup_state, ERTS_POLL_WOKEN_IO_READY);
}
else {
+ ERTS_THR_MEMORY_BARRIER;
+ wakeup_state = erts_atomic32_read(&ps->wakeup_state);
while (wakeup_state != ERTS_POLL_WOKEN_IO_READY
&& wakeup_state != ERTS_POLL_WOKEN_INTR) {
erts_aint32_t act = erts_atomic32_cmpxchg(&ps->wakeup_state,
@@ -518,6 +521,7 @@ reset_interrupt(ErtsPollSet ps)
break;
wakeup_state = act;
}
+ ERTS_THR_MEMORY_BARRIER;
}
static ERTS_INLINE void