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 Freeze for PhaserCriticalSection
impl RefUnwindSafe for PhaserCriticalSection
impl Send for PhaserCriticalSection
impl Sync for PhaserCriticalSection
impl Unpin for PhaserCriticalSection
impl UnwindSafe for PhaserCriticalSection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 8 bytes