pub struct Barrier { /* private fields */ }Expand description
A barrier that releases all n participants together once every one
of them has called Barrier::wait.
Implementations§
Source§impl Barrier
impl Barrier
Sourcepub const fn new(n: usize) -> Self
pub const fn new(n: usize) -> Self
Create a barrier requiring n participants per generation. n == 0 behaves like n == 1 (a single wait() call releases
immediately as the leader) rather than a barrier no wait() call
could ever complete.
Sourcepub async fn wait(&self) -> BarrierWaitResult
pub async fn wait(&self) -> BarrierWaitResult
Wait for every one of this barrier’s n participants to arrive.
Exactly one of the n calls in each generation gets back a
BarrierWaitResult with is_leader
true; the rest get false. All n calls return together.
Auto Trait Implementations§
impl !Freeze for Barrier
impl !RefUnwindSafe for Barrier
impl Send for Barrier
impl Sync for Barrier
impl Unpin for Barrier
impl UnsafeUnpin 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