More Rust concepts for the kernel
More Rust concepts for the kernel
Posted Sep 20, 2021 23:15 UTC (Mon) by roc (subscriber, #30627)In reply to: More Rust concepts for the kernel by atnot
Parent article: More Rust concepts for the kernel
Also, if you find yourself with exclusive ownership of a Mutex, you can call into_inner() to take ownership of the contents without taking the lock.
There probably are some weird locking patterns that Rust Mutex can't express but it's not easy to come up plausible ones out of thin air. Probably some conditional stuff where a lock is only needed under certain dynamic conditions. Of course you could probably still write a custom Mutex implementation that encapsulates those conditions in a nice way.