diff options
author | Rickard Green <[email protected]> | 2010-11-10 17:47:03 +0100 |
---|---|---|
committer | Rickard Green <[email protected]> | 2010-11-10 17:49:17 +0100 |
commit | 77e8d12f0b0479bd9bddb5d4f54a4d9e0109b888 (patch) | |
tree | 0c4d2f09a2734dc86ea3af34c90986350757801c /erts/emulator/beam/erl_process.c | |
parent | 17224a3d31d25ce6daa4de63b52b26bee9564bcd (diff) | |
download | otp-77e8d12f0b0479bd9bddb5d4f54a4d9e0109b888.tar.gz otp-77e8d12f0b0479bd9bddb5d4f54a4d9e0109b888.tar.bz2 otp-77e8d12f0b0479bd9bddb5d4f54a4d9e0109b888.zip |
Fix erts_schedule_misc_op() so it can be called from arbitrary threads
Tracing to port could cause an emulator crash when unloading the
trace driver.
Diffstat (limited to 'erts/emulator/beam/erl_process.c')
-rw-r--r-- | erts/emulator/beam/erl_process.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/erts/emulator/beam/erl_process.c b/erts/emulator/beam/erl_process.c index 901167a315..7631c483ed 100644 --- a/erts/emulator/beam/erl_process.c +++ b/erts/emulator/beam/erl_process.c @@ -7497,6 +7497,15 @@ erts_schedule_misc_op(void (*func)(void *), void *arg) ErtsRunQueue *rq = erts_get_runq_current(NULL); ErtsMiscOpList *molp = misc_op_list_alloc(); + if (!rq) { + /* + * This can only happen when the sys msg dispatcher + * thread schedules misc ops (this happens *very* + * seldom; only when trace drivers are unloaded). + */ + rq = ERTS_RUNQ_IX(0); + } + erts_smp_runq_lock(rq); while (rq->misc.evac_runq) { |