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:
Carl Lerche
2023-08-04 08:24:01 -07:00
committed by GitHub
parent 38d1bcd9df
commit 7c54fdce3e
@@ -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) };