Struct synchronoise::phaser::PhaserCriticalSection
source · [−]pub struct PhaserCriticalSection { /* private fields */ }
Expand description
Guard struct that represents a “writer critical section” for a WriterReaderPhaser
.
PhaserCriticalSection
is a scope-based guard to signal the beginning and end of a “writer
critical section” to the phaser. Upon calling writer_critical_section
, the phaser atomically
increments a counter, and when the returned PhaserCriticalSection
drops, the drop
call
atomically increments another counter. On platforms with atomic increment instructions, this
should result in wait-free synchronization.
Example
{
let _guard = phaser.writer_critical_section();
// perform writes
} // _guard drops, signaling the end of the section
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for PhaserCriticalSection
impl Send for PhaserCriticalSection
impl Sync for PhaserCriticalSection
impl Unpin for PhaserCriticalSection
impl UnwindSafe for PhaserCriticalSection
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more