aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2017-08-16 17:35:32 +0200
committerLukas Larsson <[email protected]>2017-08-16 17:35:32 +0200
commit33b3697ae98147e0470d8d08bca6c51042dcb3d1 (patch)
tree3b32fe07cf2d5e7767804633cdd70485d504e1e4 /erts/emulator/beam/erl_nif.c
parent4b7e7fe427bb3e67e267e6cb8858a83921d8aca7 (diff)
parentb2f7b51f420a233a41c885d8b44919d88f1e7ba5 (diff)
downloadotp-33b3697ae98147e0470d8d08bca6c51042dcb3d1.tar.gz
otp-33b3697ae98147e0470d8d08bca6c51042dcb3d1.tar.bz2
otp-33b3697ae98147e0470d8d08bca6c51042dcb3d1.zip
Merge branch 'lukas/erts/fix_dirty_trace_message_flush/OTP-14538' into maint
* lukas/erts/fix_dirty_trace_message_flush/OTP-14538: erts: Must have main lock when flushing trace messages
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index d3c5af3a83..9caeed3273 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -588,6 +588,10 @@ int erts_flush_trace_messages(Process *c_p, ErtsProcLocks c_p_locks)
ErlTraceMessageQueue *msgq, **last_msgq;
int reds = 0;
+ /* Only one thread at a time is allowed to flush trace messages,
+ so we require the main lock to be held when doing the flush */
+ ERTS_SMP_CHK_HAVE_ONLY_MAIN_PROC_LOCK(c_p);
+
erts_smp_proc_lock(c_p, ERTS_PROC_LOCK_TRACE);
msgq = c_p->trace_msg_q;