Struct spinning_top::RawSpinlock [−][src]
pub struct RawSpinlock { /* fields omitted */ }
Expand description
Provides mutual exclusion based on spinning on an AtomicBool
.
It’s recommended to use this type either combination with lock_api::Mutex
or
through the Spinlock
type.
Example
use lock_api::RawMutex; let lock = spinning_top::RawSpinlock::INIT; assert_eq!(lock.try_lock(), true); // lock it assert_eq!(lock.try_lock(), false); // can't be locked a second time unsafe { lock.unlock(); } // unlock it assert_eq!(lock.try_lock(), true); // now it can be locked again
Trait Implementations
impl Debug for RawSpinlock
[src]
impl Debug for RawSpinlock
[src]impl RawMutex for RawSpinlock
[src]
impl RawMutex for RawSpinlock
[src]const INIT: RawSpinlock
[src]
const INIT: RawSpinlock
[src]Initial value for an unlocked mutex.
type GuardMarker = GuardSend
type GuardMarker = GuardSend
Marker type which determines whether a lock guard should be Send
. Use
one of the GuardSend
or GuardNoSend
helper types here. Read more