feat: add RwSpinlock readers-writer lock#18
Conversation
|
Rebased on latest |
|
Looks like this still uses the backoff feature instead of the |
phil-opp
left a comment
There was a problem hiding this comment.
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. |
This adds the
RwSpinlockimplementation fromhermit-sync, which has been derived fromspin, butUPGRADABLEandEXCLUSIVE,impl RawRwLockRecursive.Depends on #16 for the backoff feature.
Closes #15