aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2016-06-16 08:44:49 +0200
committerLukas Larsson <[email protected]>2016-06-16 08:44:49 +0200
commit3c84636abdc7c84eb9c8ea929468721b99469721 (patch)
tree914cdfcca71a151a9c2e667e871f947ebaee92dc /erts/emulator/beam
parent7bfb67a155f2adbb94df0d6a2e966c84951cd04a (diff)
parent4e87bebe004039465548ed432d363f2d7e42fee6 (diff)
downloadotp-3c84636abdc7c84eb9c8ea929468721b99469721.tar.gz
otp-3c84636abdc7c84eb9c8ea929468721b99469721.tar.bz2
otp-3c84636abdc7c84eb9c8ea929468721b99469721.zip
Merge branch 'lukas/erts/nif_allow_port_command_in_non_sched_thread/OTP-13442'
* lukas/erts/nif_allow_port_command_in_non_sched_thread/OTP-13442: erts: Allow enif_port_command in non-sched thread
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_nif.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index 039f97ef43..23931f0e54 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -769,32 +769,25 @@ enif_port_command(ErlNifEnv *env, const ErlNifPort* to_port,
if (scheduler > 0)
prt = erts_port_lookup(to_port->port_id, iflags);
-#ifdef ERTS_DIRTY_SCHEDULERS
- else if (scheduler < 0) {
+ else {
+#ifdef ERTS_SMP
if (ERTS_PROC_IS_EXITING(c_p))
return 0;
prt = erts_thr_port_lookup(to_port->port_id, iflags);
- }
+#else
+ erts_exit(ERTS_ABORT_EXIT,
+ "enif_port_command: called from non-scheduler "
+ "thread on non-SMP VM");
#endif
- else {
- erts_exit(ERTS_ABORT_EXIT, "enif_port_command: "
- "called from non-scheduler thread");
}
if (!prt)
res = 0;
- else {
-
- if (IS_TRACED_FL(prt, F_TRACE_RECEIVE))
- trace_port_receive(prt, c_p->common.id, am_command, msg);
-
- res = erts_port_output_async(prt, c_p->common.id, msg);
- }
+ else
+ res = erts_port_output_async(prt, c_p->common.id, msg);
-#ifdef ERTS_DIRTY_SCHEDULERS
- if (scheduler < 0)
+ if (scheduler <= 0)
erts_port_dec_refc(prt);
-#endif
return res;
}