aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2013-04-04 17:46:17 +0200
committerPatrik Nyblom <[email protected]>2013-04-04 17:46:17 +0200
commit1e282b7b0c092f8f4619383741262583ff99b64c (patch)
tree4bab57ce3f8c1195543aa3eae066a767a78e0723 /erts/emulator/beam
parent8d70fd874ae4da853ac79f4349fbf4a985950656 (diff)
downloadotp-1e282b7b0c092f8f4619383741262583ff99b64c.tar.gz
otp-1e282b7b0c092f8f4619383741262583ff99b64c.tar.bz2
otp-1e282b7b0c092f8f4619383741262583ff99b64c.zip
Make port close not be delayed
Drivers are dereferenced when the port is completely gone, in the operation scheduled with erts_schedule_thr_prgr_later_op. If we use erts_schedule_thr_prgr_later_cleanup_op, it may not happen for a long time and the driver can not be unloaded. We can not dereference the driver before the thread_progress_later thing, because references to the driver may exist in other threads, so the unloading of the driver may free locks held by other schedulers and whatnot.
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/erl_port_task.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/erts/emulator/beam/erl_port_task.c b/erts/emulator/beam/erl_port_task.c
index 23000391ec..0ed08bee01 100644
--- a/erts/emulator/beam/erl_port_task.c
+++ b/erts/emulator/beam/erl_port_task.c
@@ -2001,10 +2001,10 @@ begin_port_cleanup(Port *pp, ErtsPortTask **execqp, int *processing_busy_q_p)
* Schedule cleanup of port structure...
*/
#ifdef ERTS_SMP
- erts_schedule_thr_prgr_later_cleanup_op(release_port,
- (void *) pp,
- &pp->common.u.release,
- sizeof(Port));
+ /* 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