-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add RwSpinlock
readers-writer lock
#18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Rebased on latest |
Looks like this still uses the backoff feature instead of the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks a lot!
Note that I'm not an expert atomic operations, so I'm not 100% certain that all the orderings etc are correct. They looked all reasonable to me, though, and I didn't notice any issues.
It would be great if we could apply some more tooling to catch potential issues at some point (in some future PR). For example, we could run the randomized lock/unlock tests under a data race detector.
Signed-off-by: Martin Kröning <martin.kroening@eonerc.rwth-aachen.de>
Fixed. I forgot during rebase. 😅
Good point. Did you have any specific tool in mind? I took a look at loom once, but their atomics are not |
Thanks!
Yeah, looks like loom will be difficult to use then. I found this related issue: tokio-rs/loom#170 As an alternative, we could try Miri or ThreadSanitizer, which provide less strong guarantees, but should be easier to set up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fixes!
This adds the
RwSpinlock
implementation fromhermit-sync
, which has been derived fromspin
, butUPGRADABLE
andEXCLUSIVE
,impl RawRwLockRecursive
.Depends on #16 for the backoff feature.
Closes #15