Macro lilos::create_mutex
source · macro_rules! create_mutex { ($var:ident, $contents:expr) => { ... }; }
Expand description
Convenience macro for creating a pinned mutex on the stack.
This declares a local variable ident
of type Pin<&mut Mutex<T>>
, where
T
is the type of expr
. The contents of the mutex are initialized to the
value of expr
.
For instance,
ⓘ
create_mutex!(my_mutex, 42usize);
// ...
*my_mutex.lock().await += 4; // now contains 46