From 63bfb6131f1c36031d891df93acd2521ac38eb02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yara=20=F0=9F=8F=B3=EF=B8=8F=E2=80=8D=E2=9A=A7=EF=B8=8F?= Date: Mon, 15 Dec 2025 14:18:06 +0100 Subject: [PATCH] scheduler: Fix background threads ending early (#44878) Release Notes: - N/A Co-authored-by: kate --- crates/gpui/src/queue.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/gpui/src/queue.rs b/crates/gpui/src/queue.rs index 3a4ef912ffd5fb85b80384454f7afd84cecb1648..9e9da710977ee80df1853791918eebe5e7f01096 100644 --- a/crates/gpui/src/queue.rs +++ b/crates/gpui/src/queue.rs @@ -58,8 +58,7 @@ impl PriorityQueueState { return Err(crate::queue::RecvError); } - // parking_lot doesn't do spurious wakeups so an if is fine - if queues.is_empty() { + while queues.is_empty() { self.condvar.wait(&mut queues); } @@ -265,7 +264,7 @@ impl Iterator for Iter { type Item = T; fn next(&mut self) -> Option { - self.0.pop_inner(true).ok().flatten() + self.0.pop().ok() } } impl FusedIterator for Iter {} @@ -283,7 +282,7 @@ impl Iterator for TryIter { return None; } - let res = self.receiver.pop_inner(false); + let res = self.receiver.try_pop(); self.ended = res.is_err(); res.transpose()