Skip to main content

declare_singleton_mutex

Macro declare_singleton_mutex 

Source
macro_rules! declare_singleton_mutex {
    ($($args:tt)*) => { ... };
}
Expand description

Declares a singleton mutex.

This macro defines a struct with the given name and visibility, registers it as a singleton lock with lockdep under the rust_lock_classes linker section, and provides accessors (Get(), get(), lock(), and lock_policy()) to a statically initialized KMutex.

ยงExamples

ksync::declare_singleton_mutex!(MyGlobalLock);

// Usage:
ksync::lock!(MyGlobalLock::get().lock());
// or
ksync::lock!(MyGlobalLock::lock());