Locking
Locking
Posted Sep 23, 2024 17:35 UTC (Mon) by tialaramex (subscriber, #21167)Parent article: Resources for learning Rust for kernel development
The lack of "unlock" has led to proposals to give Rust's Mutex<T> type an unlock method.
The way you'd do that is your unlock function takes the guard as a parameter. Since Rust has the destructive move semantic, the unlock doesn't need to actually "do" anything, it can return immediately - the guard was moved into the function and then not returned, it's gone - it was dropped, which gives effect to the programmer's intent.
