mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
executor: shut down idle threads in the blocking pool (#1514)
This commit is contained in:
committed by
Carl Lerche
parent
15dc0563b7
commit
3d9134d13e
@@ -109,12 +109,16 @@ fn spawn_thread() {
|
||||
shared.num_idle += 1;
|
||||
|
||||
loop {
|
||||
shared = POOL.condvar.wait_timeout(shared, KEEP_ALIVE).unwrap().0;
|
||||
let lock_result = POOL.condvar.wait_timeout(shared, KEEP_ALIVE).unwrap();
|
||||
shared = lock_result.0;
|
||||
let timeout_result = lock_result.1;
|
||||
|
||||
if let Some(task) = shared.queue.pop_front() {
|
||||
drop(shared);
|
||||
run_task(task);
|
||||
continue 'outer;
|
||||
} else if timeout_result.timed_out() {
|
||||
break 'outer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user