mirror of
https://github.com/zed-industries/zed.git
synced 2026-06-01 03:14:56 +07:00
scheduler: Fix background threads ending early (#44878)
Release Notes: - N/A Co-authored-by: kate <work@localcc.cc>
This commit is contained in:
parent
5fe7fd97bd
commit
63bfb6131f
1 changed files with 3 additions and 4 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue