pub struct Barrier(/* private fields */);Expand description
A collection of cursors that determine which sequence is available to a handle.
Every handle has a barrier, and no handle may overtake its barrier.
Implementations§
Source§impl Barrier
impl Barrier
Sourcepub fn sequence(&self) -> i64
pub fn sequence(&self) -> i64
The position of the barrier.
§Examples
use ansa::{Barrier, wait::WaitStrategy};
struct MyBusyWait;
// SAFETY: wait returns once barrier seq >= desired_seq, with barrier seq itself
unsafe impl WaitStrategy for MyBusyWait {
fn wait(&self, desired_seq: i64, barrier: &Barrier) -> i64 {
while barrier.sequence() < desired_seq {} // busy-spin
barrier.sequence()
}
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Barrier
impl RefUnwindSafe for Barrier
impl Send for Barrier
impl Sync for Barrier
impl Unpin for Barrier
impl UnwindSafe for Barrier
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
Mutably borrows from an owned value. Read more