diff options
author | Lukas Larsson <[email protected]> | 2013-09-02 16:30:27 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2013-09-02 16:30:27 +0200 |
commit | c88a0d41c4ecaf0b655354c612d57f49e031c6c8 (patch) | |
tree | 44d93ffa5b31a6967e452035ae831f7b51bcbd39 /erts | |
parent | b5a8aefd0bfa04ea770a9ec869cd079c37278629 (diff) | |
parent | 3515e75661a0e2c5a37eb226b9f2ea94b122e87b (diff) | |
download | otp-c88a0d41c4ecaf0b655354c612d57f49e031c6c8.tar.gz otp-c88a0d41c4ecaf0b655354c612d57f49e031c6c8.tar.bz2 otp-c88a0d41c4ecaf0b655354c612d57f49e031c6c8.zip |
Merge branch 'maint'
* maint:
erts: Fix segfault when scheduling release_port later_op
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/beam/erl_port_task.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c index 7d53ce7152..547a42beb2 100644 --- a/erts/emulator/beam/erl_port_task.c +++ b/erts/emulator/beam/erl_port_task.c @@ -1838,6 +1838,16 @@ release_port(void *vport) { erts_port_dec_refc((Port *) vport); } + +static void +schedule_release_port(void *vport) { + Port *pp = (Port*)vport; + /* This is only used when a port release was ordered from a non-scheduler */ + erts_schedule_thr_prgr_later_op(release_port, + (void *) pp, + &pp->common.u.release); +} + #endif static void @@ -2033,10 +2043,15 @@ begin_port_cleanup(Port *pp, ErtsPortTask **execqp, int *processing_busy_q_p) * Schedule cleanup of port structure... */ #ifdef ERTS_SMP - /* Has to be more or less immediate to release any driver */ - erts_schedule_thr_prgr_later_op(release_port, - (void *) pp, - &pp->common.u.release); + /* We might not be a scheduler, eg. traceing to port we are sys_msg_dispatcher */ + if (!erts_get_scheduler_data()) { + erts_schedule_misc_aux_work(1, schedule_release_port, (void*)pp); + } else { + /* Has to be more or less immediate to release any driver */ + erts_schedule_thr_prgr_later_op(release_port, + (void *) pp, + &pp->common.u.release); + } #else pp->cleanup = 1; #endif |