Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

scheduler: Fix background threads ending early (#44878)

Yara 🏳️‍⚧️63bfb6131f1c
diff --git a/crates/gpui/src/queue.rs b/crates/gpui/src/queue.rs
index 3a4ef912ffd..9e9da710977 100644
--- a/crates/gpui/src/queue.rs
+++ b/crates/gpui/src/queue.rs
@@ -58,8 +58,7 @@ impl<T> PriorityQueueState<T> {
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<T> Iterator for Iter<T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
- self.0.pop_inner(true).ok().flatten()
+ self.0.pop().ok()
}
}
impl<T> FusedIterator for Iter<T> {}
@@ -283,7 +282,7 @@ impl<T> Iterator for TryIter<T> {
return None;
}
- let res = self.receiver.pop_inner(false);
+ let res = self.receiver.try_pop();
self.ended = res.is_err();
res.transpose()