Commit bb856b66 authored by Adam Wujek's avatar Adam Wujek 💬

userspace/wrsw_hal: add support for shmem init-time lock

Release write lock when HAL's shm is populated with correct data.
Requires commit: "userspace/libwr: shmem init-time lock"
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 838035d2
......@@ -196,8 +196,10 @@ int hal_port_init_all()
__func__, strerror(errno));
return -1;
}
/* Allocate the ports in shared memory, so wr_mon etc can see them */
hal_port_shmem = wrs_shm_get(wrs_shm_hal, "wrsw_hal", WRS_SHM_WRITE);
/* Allocate the ports in shared memory, so wr_mon etc can see them
Use lock since some (like rtud) wait for hal to be available */
hal_port_shmem = wrs_shm_get(wrs_shm_hal, "wrsw_hal",
WRS_SHM_WRITE | WRS_SHM_LOCKED);
if (!hal_port_shmem) {
fprintf(stderr, "%s: Can't join shmem: %s\n", __func__,
strerror(errno));
......@@ -227,6 +229,12 @@ int hal_port_init_all()
hal_hdr->nports = hal_port_nports;
head->version = HAL_SHMEM_VERSION;
/* Release processes waiting for HAL's to fill shm with correct data
When shm is opened successfully data in shm is still not populated!
Read data with wrs_shm_seqbegin and wrs_shm_seqend!
Especially for nports it is important */
wrs_shm_write(head, WRS_SHM_WRITE_END);
/* Create a WRIPC server for HAL public API */
return hal_init_wripc(ports);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment