aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2016-04-01 20:18:55 +0200
committerErlang/OTP <[email protected]>2016-04-01 20:18:55 +0200
commitce7658b590ccbef73d9b1faf2dcad35dc1edfb91 (patch)
tree5d97ff0f487b4d8ebd535643d51d913920baa73f /erts
parent026f04a07e396603943c373f6eb541c1ed4500af (diff)
parentc048886458ce68280ba32647a93a04902c929988 (diff)
downloadotp-ce7658b590ccbef73d9b1faf2dcad35dc1edfb91.tar.gz
otp-ce7658b590ccbef73d9b1faf2dcad35dc1edfb91.tar.bz2
otp-ce7658b590ccbef73d9b1faf2dcad35dc1edfb91.zip
Merge branch 'sverker/erts/trap_exit-race/OTP-13452' into maint-18
* sverker/erts/trap_exit-race/OTP-13452: erts: Fix race for process_flag(trap_exit,true)
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/bif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/erts/emulator/beam/bif.c b/erts/emulator/beam/bif.c
index 66c2853534..095df36a43 100644
--- a/erts/emulator/beam/bif.c
+++ b/erts/emulator/beam/bif.c
@@ -1605,14 +1605,17 @@ BIF_RETTYPE process_flag_2(BIF_ALIST_2)
* true. For more info, see implementation of
* erts_send_exit_signal().
*/
+ erts_smp_proc_lock(BIF_P, ERTS_PROC_LOCKS_XSIG_SEND);
if (trap_exit)
state = erts_smp_atomic32_read_bor_mb(&BIF_P->state,
ERTS_PSFLG_TRAP_EXIT);
else
state = erts_smp_atomic32_read_band_mb(&BIF_P->state,
~ERTS_PSFLG_TRAP_EXIT);
+ erts_smp_proc_unlock(BIF_P, ERTS_PROC_LOCKS_XSIG_SEND);
+
#ifdef ERTS_SMP
- if (ERTS_PROC_PENDING_EXIT(BIF_P)) {
+ if (state & ERTS_PSFLG_PENDING_EXIT) {
erts_handle_pending_exit(BIF_P, ERTS_PROC_LOCK_MAIN);
ERTS_BIF_EXITED(BIF_P);
}