Two processes try to create or open a shared memory
Both detect that none is available
Both try to create a new one - only one will succeed, the other complains: shm does not exist and I cannot create a new one.
Solution: If create fails, try to reopen it.
Removes: retrieve buffer full check from zero copy sender. The sender does not have enough information available to determine if the buffer is really insufficient. It needs to know how many samples the subscriber has currently borrowed - an information only the receiver has.
Introduce memory sync in zero copy connection open procedure. When a zero copy connection is opened and the creation is still in progress, the opener will check the init_state until it is initialized. If it is signaling that the initialization is done, it will consume the contents - without memory sync. Adding acquire / release to sync the initialized memory with the other process.
Pre-Review Checklist for the PR Author
[x] Add sensible notes for the reviewer
[x] PR title is short, expressive and meaningful
[x] Relevant issues are linked
[x] Every source code file has a copyright header with SPDX-License-Identifier: Apache-2.0 OR MIT
[x] Branch follows the naming format (iox2-123-introduce-posix-ipc-example)
[x] Commits messages are according to this guideline
[x] Commit messages have the issue ID ([#123] Add posix ipc example)
Notes for Reviewer
Fixes race in
posix::SharedMemory
.Solution: If create fails, try to reopen it.
Removes: retrieve buffer full check from zero copy sender. The sender does not have enough information available to determine if the buffer is really insufficient. It needs to know how many samples the subscriber has currently borrowed - an information only the receiver has.
Introduce memory sync in zero copy connection open procedure. When a zero copy connection is opened and the creation is still in progress, the opener will check the
init_state
until it is initialized. If it is signaling that the initialization is done, it will consume the contents - without memory sync. Addingacquire
/release
to sync the initialized memory with the other process.Pre-Review Checklist for the PR Author
SPDX-License-Identifier: Apache-2.0 OR MIT
iox2-123-introduce-posix-ipc-example
)[#123] Add posix ipc example
)task-list-completed
)Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Relates to #116