pub fn join_all(&self) {
        // We have guarenteed that this thread on this
        let finished_guard = unsafe { &mut *self.state.finished_guard };

        // If the parent returns its token before the last worker:
        //  * then it must wait on the condvar unlocking the mutex
        //  * the worker must lock the mutex to ensure the parent is waiting (this removes the raciness from the atomic to notify gap)
        //  * the worker must notify release the
        // If the last worker returns its token before the parent:
        //  * the worker can just exit
        //  * the parent will know it had the last token and can just exit the join_all without waiting on the condvar
        if self.state.tokens_outstanding.fetch_sub(1, Ordering::AcqRel) > 1 {
            while !**finished_guard {
                self.state.cvar.wait(finished_guard);
            }
        }
        // Setup for next time incase this is being called
        self.state.tokens_outstanding.store(1, Ordering::Release);
        **finished_guard = false;
    }
/// Blocks until all currently queued jobs have run to completion.
///
/// This can be called at the end of the closure passed to `scope_with(..)` to ensure it does not return before the jobs it creates do.
/// It may also be called during the closure passed to `scope_with(..)` multiple times to synchronise on the completions of batches of `Scope::execute(..)` calls.
/// It will be automatically called just prior to `scope_with(..)` returning to ensure all jobs have completed.
Blocks until all currently queued jobs have run to completion.
This can be called at the end of the closure passed to `scope_with(..)` to ensure it does not return before the jobs it creates do.
It may also be called during the closure passed to `scope_with(..)` multiple times to synchronise on the completions of batches of `Scope::execute(..)` calls.
It will be automatically called just prior to `scope_with(..)` returning to ensure all jobs have completed.
Blocks until all currently queued jobs have run to completion . This can be called at the end of the closure passed to ` scope_with ( .. ) ` to ensure it does not return before the jobs it creates do . It may also be called during the closure passed to ` scope_with ( .. ) ` multiple times to synchronise on the completions of batches of ` Scope :: execute ( .. ) ` calls . It will be automatically called just prior to ` scope_with ( .. ) ` returning to ensure all jobs have completed .
pub fn join_all(&self) {
        // We have guarenteed that this thread on this
        let finished_guard = unsafe { &mut *self.state.finished_guard };
        // If the parent returns its token before the last worker:
        //  * then it must wait on the condvar unlocking the mutex
        //  * the worker must lock the mutex to ensure the parent is waiting (this removes the raciness from the atomic to notify gap)
        //  * the worker must notify release the
        // If the last worker returns its token before the parent:
        //  * the worker can just exit
        //  * the parent will know it had the last token and can just exit the join_all without waiting on the condvar
        if self.state.tokens_outstanding.fetch_sub(1, Ordering::AcqRel) > 1 {
            while !**finished_guard {
                self.state.cvar.wait(finished_guard);
            }
        }
        // Setup for next time incase this is being called
        self.state.tokens_outstanding.store(1, Ordering::Release);
        **finished_guard = false;
    }
pub fn join_all ( & self ) { // We have guarenteed that this thread on this let finished_guard = unsafe { & mut * self . state . finished_guard } ; // If the parent returns its token before the last worker: //  * then it must wait on the condvar unlocking the mutex //  * the worker must lock the mutex to ensure the parent is waiting (this removes the raciness from the atomic to notify gap) //  * the worker must notify release the // If the last worker returns its token before the parent: //  * the worker can just exit //  * the parent will know it had the last token and can just exit the join_all without waiting on the condvar if self . state . tokens_outstanding . fetch_sub ( 1 , Ordering :: AcqRel ) > 1 { while ! * * finished_guard { self . state . cvar . wait ( finished_guard ) ; } } // Setup for next time incase this is being called self . state . tokens_outstanding . store ( 1 , Ordering :: Release ) ; * * finished_guard = false ; }
Blocks until all currently queued jobs have run to completion.
Blocks until all currently queued jobs have run to completion .
&self
&self