Struct flexible_locks::RawOsMutex [] [src]

pub struct RawOsMutex<T: UnsafeRawOsMutex> { /* fields omitted */ }

Platform mutex primitives for use with [Mutex] and [MutexWrap].

While the std::sync::Mutex type only uses one kind of platform mutex primitive (except on Windows, where things are a little convoluted), flexible-locks allow to use different kinds.

The available primitives are:

Other primitives could be added in the future, such as os_unfair_lock_t on macOS.

For types that can be statically initialized, until const fn is stabilized, initializer macros are provided:

For non-static initialization, Default::default() can be used for these.

For more specific non default use cases, you may want to implement your own type and implement the [RawMutex] or [UnsafeRawOsMutex] trait for it.

Safety

Generally speaking, platform mutex primitives cannot be moved in memory. That is, they must stay at the same address. Please ensure that is the case when you use them.

Trait Implementations

impl<T: UnsafeRawOsMutex> Send for RawOsMutex<T>
[src]

impl<T: UnsafeRawOsMutex> Sync for RawOsMutex<T>
[src]

impl<T: UnsafeRawOsMutex> RawMutex for RawOsMutex<T>
[src]

[src]

Initialize the raw mutex. Read more

[src]

Acquire the raw mutex.

[src]

Release the raw mutex.

[src]

Destroy the raw mutex. Read more