// Create up to MAX_THREADS dynamic blocking task worker threads.
// Dynamic threads will terminate themselves if they don't
// receive any work after one second.
Create up to MAX_THREADS dynamic blocking task worker threads.
Dynamic threads will terminate themselves if they don't
receive any work after one second.
Create up to MAX_THREADS dynamic blocking task worker threads . Dynamic threads will terminate themselves if they don ' t receive any work after one second .
fn maybe_spawn_new_thread() -> Result<()> {
    debug_delay();
    let total_workers = TOTAL_THREAD_COUNT.load(Acquire);
    debug_delay();
    let waiting_threads = WAITING_THREAD_COUNT.load(Acquire);
    if waiting_threads >= DESIRED_WAITING_THREADS
        || total_workers >= MAX_THREADS
    {
        return Ok(());
    }
    if SPAWNING.compare_exchange_weak(false, true, Acquire, Acquire).is_ok() {
        spawn_new_thread(false)?;
    }
    Ok(())
}
fn maybe_spawn_new_thread ( ) -> Result < ( ) > { debug_delay ( ) ; let total_workers = TOTAL_THREAD_COUNT . load ( Acquire ) ; debug_delay ( ) ; let waiting_threads = WAITING_THREAD_COUNT . load ( Acquire ) ; if waiting_threads >= DESIRED_WAITING_THREADS || total_workers >= MAX_THREADS { return Ok ( ( ) ) ; } if SPAWNING . compare_exchange_weak ( false , true , Acquire , Acquire ) . is_ok ( ) { spawn_new_thread ( false ) ? ; } Ok ( ( ) ) }
Create up to MAX_THREADS dynamic blocking task worker threads.
Create up to MAX_THREADS dynamic blocking task worker threads .