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.
Also this don’t work for runtime locks. E.g Map<string, Lock<value>>. I came up with the “OrderedLock”. You specify it logically at compile time to fit into the DAG. At runtime each lock has an ordered key. Then it asserts ordered acquisition - which fits within compile time enforced ordering
0 reposts1 like
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.
It’s more I saw a lot of parallels in the design with this issue from that project (filed by one of fuschia engineers). github.com/akonradi/loc... Not knocking the post and crate it’s awesome!