pub struct BroadcastJoin<'pool, 'fork, F>{ /* private fields */ }Expand description
A synchronization guard that waits for all threads to finish the broadcasted closure.
The lifecycle is keyed on the pool’s exclusivity:
- On
CallerExclusivity::Exclusivepools the closure is dispatched at construction: the workers start immediately, the caller can overlap its own work, pollis_complete, andjoin(orDrop) waits for completion. - On
CallerExclusivity::Inclusivepools the dispatch is deferred to join (orDrop), where the calling thread contributes its own slice of the work.
The closure is borrowed rather than owned, so its address stays stable while worker threads hold a pointer to it, and the guard itself remains freely movable.
Implementations§
Source§impl<'pool, 'fork, F> BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> BroadcastJoin<'pool, 'fork, F>
Sourcepub fn generation(&self) -> Option<usize>
pub fn generation(&self) -> Option<usize>
The generation token of this broadcast; always odd once dispatched.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
True once the dispatched generation has fully completed on all threads.
A true result also guarantees visibility of every contributor’s writes. On
Inclusive pools this can only turn true once join contributes the calling
thread’s slice, so the poll-then-join pattern is reserved for Exclusive pools.
Trait Implementations§
Source§impl<F> Drop for BroadcastJoin<'_, '_, F>
impl<F> Drop for BroadcastJoin<'_, '_, F>
Auto Trait Implementations§
impl<'pool, 'fork, F> !UnwindSafe for BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> Freeze for BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> RefUnwindSafe for BroadcastJoin<'pool, 'fork, F>where
&'fork F: RefUnwindSafe,
impl<'pool, 'fork, F> Send for BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> Sync for BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> Unpin for BroadcastJoin<'pool, 'fork, F>
impl<'pool, 'fork, F> UnsafeUnpin for BroadcastJoin<'pool, 'fork, F>where
&'fork F: UnsafeUnpin,
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