mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-20 00:00:08 +02:00
rt: pop at least one task from inject queue (#5908)
When attempting to pull a batch of tasks from the injection queue, ensure we set the cap to at least one.
This commit is contained in:
@@ -787,6 +787,10 @@ impl Core {
|
||||
cap,
|
||||
);
|
||||
|
||||
// Take at least one task since the first task is returned directly
|
||||
// and nto pushed onto the local queue.
|
||||
let n = usize::max(1, n);
|
||||
|
||||
let mut synced = worker.handle.shared.synced.lock();
|
||||
// safety: passing in the correct `inject::Synced`.
|
||||
let mut tasks = unsafe { worker.inject().pop_n(&mut synced.inject, n) };
|
||||
|
||||
Reference in New Issue
Block a user