diff options
author | Lukas Larsson <[email protected]> | 2016-05-17 14:56:01 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-05-17 14:56:01 +0200 |
commit | 49d43cd5c5058b5244d0b8e57667fb22c7eb3a09 (patch) | |
tree | 0bd384582d55550219692686b2d9924257b24c3b /erts/emulator/beam/erl_nif.c | |
parent | 8f213ab9fc5e87f4d54c134bd3d7017ab772b452 (diff) | |
parent | 1ba422f4e4a18dd9874c9704b73cbf38b4252fa7 (diff) | |
download | otp-49d43cd5c5058b5244d0b8e57667fb22c7eb3a09.tar.gz otp-49d43cd5c5058b5244d0b8e57667fb22c7eb3a09.tar.bz2 otp-49d43cd5c5058b5244d0b8e57667fb22c7eb3a09.zip |
Merge branch 'lukas/erts/tracing/fix-non-smp-trace/OTP-13503'
* lukas/erts/tracing/fix-non-smp-trace/OTP-13503:
erts: Fix erl_tracer xml doc errors
erts: Fix bug when tracing in non-smp non-scheduler thread
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 159dc66ad5..bd9367a3d5 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -667,6 +667,9 @@ int enif_send(ErlNifEnv* env, const ErlNifPid* to_pid, erts_smp_proc_trylock(rp, ERTS_PROC_LOCK_MSGQ) == EBUSY) { if (!msgq) { +#ifdef ERTS_SMP + ErtsThrPrgrDelayHandle dhndl; +#endif msgq = erts_alloc(ERTS_ALC_T_TRACE_MSG_QUEUE, sizeof(ErlTraceMessageQueue)); @@ -681,8 +684,15 @@ int enif_send(ErlNifEnv* env, const ErlNifPid* to_pid, erts_smp_proc_unlock(t_p, ERTS_PROC_LOCK_TRACE); +#ifdef ERTS_SMP + if (!scheduler) + dhndl = erts_thr_progress_unmanaged_delay(); +#endif erts_schedule_flush_trace_messages(t_p->common.id); - +#ifdef ERTS_SMP + if (!scheduler) + erts_thr_progress_unmanaged_continue(dhndl); +#endif } else { msgq->len++; *msgq->last = mp; @@ -1669,7 +1679,8 @@ int enif_is_process_alive(ErlNifEnv* env, ErlNifPid *proc) return !!rp; #else erts_exit(ERTS_ABORT_EXIT, "enif_is_process_alive: " - "called from non-scheduler thread"); + "called from non-scheduler thread " + "in non-smp emulator"); return 0; #endif } @@ -1694,7 +1705,8 @@ int enif_is_port_alive(ErlNifEnv *env, ErlNifPort *port) return !!prt; #else erts_exit(ERTS_ABORT_EXIT, "enif_is_port_alive: " - "called from non-scheduler thread"); + "called from non-scheduler thread " + "in non-smp emulator"); return 0; #endif } |