diff options
author | Rickard Green <[email protected]> | 2016-08-11 15:45:05 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2016-08-11 16:22:18 +0200 |
commit | 17c838402c6d71aef041548ad36ee66db6f24a56 (patch) | |
tree | 7d0074dc86913ddb0812157e0d8513d729cbc0ff /erts/emulator/beam/erl_hl_timer.c | |
parent | 74a95b3d511177a9b35c2b0272b9ca5511b6f750 (diff) | |
download | otp-17c838402c6d71aef041548ad36ee66db6f24a56.tar.gz otp-17c838402c6d71aef041548ad36ee66db6f24a56.tar.bz2 otp-17c838402c6d71aef041548ad36ee66db6f24a56.zip |
Fix race causing lost wakeup on receive-after timeout
Diffstat (limited to 'erts/emulator/beam/erl_hl_timer.c')
-rw-r--r-- | erts/emulator/beam/erl_hl_timer.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_hl_timer.c b/erts/emulator/beam/erl_hl_timer.c index 51a0d68247..96bb5ac9fa 100644 --- a/erts/emulator/beam/erl_hl_timer.c +++ b/erts/emulator/beam/erl_hl_timer.c @@ -735,7 +735,10 @@ proc_timeout_common(Process *proc, void *tmr) if (tmr == (void *) erts_smp_atomic_cmpxchg_mb(&proc->common.timer, ERTS_PTMR_TIMEDOUT, (erts_aint_t) tmr)) { - erts_aint32_t state = erts_smp_atomic32_read_acqb(&proc->state); + erts_aint32_t state; + erts_smp_proc_lock(proc, ERTS_PROC_LOCKS_MSG_RECEIVE); + state = erts_smp_atomic32_read_acqb(&proc->state); + erts_smp_proc_unlock(proc, ERTS_PROC_LOCKS_MSG_RECEIVE); if (!(state & (ERTS_PSFLG_ACTIVE|ERTS_PSFLG_EXITING))) erts_schedule_process(proc, state, 0); return 1; |