Skip to content

Robust Lock #64

Answered by Squadrick
vlad-nn asked this question in Q&A
Nov 22, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

@vlad-nn You've raised great points, let me respond to them all:

  1. Correct, this is possible.
  2. Correct, this is possible. I couldn't think of any way to avoid this edge case, do you have any suggestions?
  3. The mutex is initialized in shm::memory::Memory. It uses POSIX shm_open's EEXIST error code to ensure that the shared memory is initialized only once. There's another mechanism here to protect against dead processes too (PIDSet). The initialization is slow, but happens only once across all the processes communicating.
  4. Good catch. I'll raise a PR to fix this.
  5. See 3., the RobustMutex will be initialized only once, which is when it is set to 0, and unlocked.
  6. Correct. I had to rely on undefined…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vlad-nn
Comment options

Answer selected by vlad-nn
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants