|
|
Subscribe / Log in / New account

Note similarity between Rust references and reader-writer locks

Note similarity between Rust references and reader-writer locks

Posted Mar 13, 2025 19:12 UTC (Thu) by farnz (subscriber, #17727)
In reply to: Note similarity between Rust references and reader-writer locks by NYKevin
Parent article: Capability analysis for the kernel

To be clear, this was more meant in terms of reading the code, not writing it - if you see an &mut, you know that you already have exclusive access to the thing you're looking at, and thus that you don't need to look for locking.

Thus, if your typestate had a way to get an Option<&mut P> from a ParentHandle, I'd be reduced to confirming that the only way for that option to be None is if the weak reference to parent was already dangling, and thus there is no parent to lock.


to post comments


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds