aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_process_lock.h
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_process_lock.h
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_process_lock.h')
-rw-r--r--erts/emulator/beam/erl_process_lock.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_process_lock.h b/erts/emulator/beam/erl_process_lock.h
index 2cccf0697a..e7d68f0a09 100644
--- a/erts/emulator/beam/erl_process_lock.h
+++ b/erts/emulator/beam/erl_process_lock.h
@@ -219,6 +219,10 @@ typedef struct erts_proc_lock_t_ {
#define ERTS_PROC_LOCKS_ALL_MINOR (ERTS_PROC_LOCKS_ALL \
& ~ERTS_PROC_LOCK_MAIN)
+/* All locks we first must unlock to lock L */
+#define ERTS_PROC_LOCKS_HIGHER_THAN(L) \
+ (ERTS_PROC_LOCKS_ALL & (~(L) & ~((L)-1)))
+
#define ERTS_PIX_LOCKS_BITS 10
#define ERTS_NO_OF_PIX_LOCKS (1 << ERTS_PIX_LOCKS_BITS)