Surelock by @expede.wtf is a really fascinating and impressive use of the Rust type system to prevent deadlocks at compile time. I will 100% be using this for future Rust projects. notes.brooklynzelenka.com/Blog/Surelock
Post
Unfortunate github.com/akonradi/loc... wasn’t included as prior art as well. I have vibe coded something similar based on it, with a proc macro for specifying the DAG.
Seems like surelock should handle runtime locks? Or do you mean the lock-ordering crate? I think @expede.wtf wasn't trying to list all prior art, just the ones that influenced the design.
The LockSet idea is really cool, but misses out on some flexibility. My understanding is you pre-declare the locks you need (LockSet does ordering internally). But it’s common to not know what locks you need upfront. For this the application needs to be in control of ordering.
To demonstrate this I open sourced my version (it implements the lock guard suggestion from the original lock-ordering gh issue + ordered map). See for ordered map use case codeberg.org/snowytrees/l... I think you can hide this from non-advanced users by doing a default impl with auto-ordering.
Under the hood this works by overloading the ZST lock guards, the ordered lock guard stores the ZST + the last key. Thus the guards represent a "stack" of ordering keys. Allowing for releasing (popping) and acquiring (pushing) ordered values into the runtime lock stack. codeberg.org/snowytrees/l...
Yes to user orderings. Since I didn’t think of the LockSet/pre-declaration api, no auto assignment (yet at least). auto assignment isn’t useful without the pre-declaration API. Since app doesn’t know what order to acquire itself.
0 reposts1 like