aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-03-24 16:20:51 +0100
committerRickard Green <[email protected]>2016-03-24 17:33:15 +0100
commitab884c3fdda00479d636de82d68ffbd8628c5c20 (patch)
tree168f9c7ed67c21e537f31dbc0510c6cf88b872b2 /erts/emulator/beam/io.c
parent9615753e42d55b3bad042791a1b36b0ef7f0090a (diff)
downloadotp-ab884c3fdda00479d636de82d68ffbd8628c5c20.tar.gz
otp-ab884c3fdda00479d636de82d68ffbd8628c5c20.tar.bz2
otp-ab884c3fdda00479d636de82d68ffbd8628c5c20.zip
Improve process/port specific data management
Diffstat (limited to 'erts/emulator/beam/io.c')
-rw-r--r--erts/emulator/beam/io.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c
index 797e4cdadc..cc58423938 100644
--- a/erts/emulator/beam/io.c
+++ b/erts/emulator/beam/io.c
@@ -397,7 +397,7 @@ static Port *create_port(char *name,
prt->common.u.alive.reg = NULL;
ERTS_PTMR_INIT(prt);
erts_port_task_handle_init(&prt->timeout_task);
- prt->psd = NULL;
+ erts_smp_atomic_init_nob(&prt->psd, (erts_aint_t) NULL);
prt->async_open_port = NULL;
prt->drv_data = (SWord) 0;
prt->os_pid = -1;
@@ -3520,6 +3520,7 @@ terminate_port(Port *prt)
Eterm connected_id = NIL /* Initialize to silence compiler */;
erts_driver_t *drv;
erts_aint32_t state;
+ ErtsPrtSD *psd;
ERTS_SMP_CHK_NO_PROC_LOCKS;
ERTS_SMP_LC_ASSERT(erts_lc_is_port_locked(prt));
@@ -3573,8 +3574,9 @@ terminate_port(Port *prt)
erts_cleanup_port_data(prt);
- if (prt->psd)
- erts_free(ERTS_ALC_T_PRTSD, prt->psd);
+ psd = (ErtsPrtSD *) erts_smp_atomic_read_nob(&prt->psd);
+ if (psd)
+ erts_free(ERTS_ALC_T_PRTSD, psd);
ASSERT(prt->dist_entry == NULL);