aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_message.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-01-12 18:12:38 +0100
committerSverker Eriksson <[email protected]>2017-01-12 18:12:38 +0100
commit9e862df2bf26b9b1d79ba3b447945b7c0612e3d0 (patch)
tree8aac2a9cb645ecc836f749f5fee793df2018bad7 /erts/emulator/beam/erl_message.c
parent1239d92556cc0a7921648cbd4abd9f9a397b29b8 (diff)
downloadotp-9e862df2bf26b9b1d79ba3b447945b7c0612e3d0.tar.gz
otp-9e862df2bf26b9b1d79ba3b447945b7c0612e3d0.tar.bz2
otp-9e862df2bf26b9b1d79ba3b447945b7c0612e3d0.zip
erts: Add macro ERTS_PROC_LOCKS_HIGHER_THAN
to safeguard against bugs due to future proc lock changes. The two places now using ERTS_PROC_LOCKS_HIGHER_THAN were kind of bugs as BTM and TRACE locks were missing. But there was probably no way to get there with BTM or TRACE locked.
Diffstat (limited to 'erts/emulator/beam/erl_message.c')
-rw-r--r--erts/emulator/beam/erl_message.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 118adc0c1b..04f9640a17 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -285,9 +285,11 @@ erts_queue_dist_message(Process *rcvr,
if (!(rcvr_locks & ERTS_PROC_LOCK_MSGQ)) {
if (erts_smp_proc_trylock(rcvr, ERTS_PROC_LOCK_MSGQ) == EBUSY) {
ErtsProcLocks need_locks = ERTS_PROC_LOCK_MSGQ;
- if (rcvr_locks & ERTS_PROC_LOCK_STATUS) {
- erts_smp_proc_unlock(rcvr, ERTS_PROC_LOCK_STATUS);
- need_locks |= ERTS_PROC_LOCK_STATUS;
+ ErtsProcLocks unlocks =
+ rcvr_locks & ERTS_PROC_LOCKS_HIGHER_THAN(ERTS_PROC_LOCK_MSGQ);
+ if (unlocks) {
+ erts_smp_proc_unlock(rcvr, unlocks);
+ need_locks |= unlocks;
}
erts_smp_proc_lock(rcvr, need_locks);
}
@@ -406,7 +408,7 @@ queue_messages(Process* receiver,
if (state & (ERTS_PSFLG_EXITING|ERTS_PSFLG_PENDING_EXIT))
goto exiting;
- need_locks = receiver_locks & (ERTS_PROC_LOCK_STATUS|ERTS_PROC_LOCK_TRACE);
+ need_locks = receiver_locks & ERTS_PROC_LOCKS_HIGHER_THAN(ERTS_PROC_LOCK_MSGQ);
if (need_locks) {
erts_smp_proc_unlock(receiver, need_locks);
}