aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/io.c
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2016-03-29 14:54:24 +0200
committerRickard Green <[email protected]>2016-03-29 14:54:24 +0200
commit96a0a707c6a7ba7ce9d6668705ca10c66666a8c3 (patch)
tree9f55aa77dae8b5875358fab76338dc3ec3c6cbba /erts/emulator/beam/io.c
parent60479cec6169d3d3495f5e8e6cadee30d22a4d60 (diff)
parentab884c3fdda00479d636de82d68ffbd8628c5c20 (diff)
downloadotp-96a0a707c6a7ba7ce9d6668705ca10c66666a8c3.tar.gz
otp-96a0a707c6a7ba7ce9d6668705ca10c66666a8c3.tar.bz2
otp-96a0a707c6a7ba7ce9d6668705ca10c66666a8c3.zip
Merge branch 'rickard/improve-psd/OTP-13428'
* rickard/improve-psd/OTP-13428: 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 324c05c766..b2fd8984fd 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;
@@ -3531,6 +3531,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));
@@ -3584,8 +3585,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);