Skip to content

Commit b3217db

Browse files
committed
hyperapp: fix spawn bugs
1 parent fbefdbd commit b3217db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/hyperapp.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,14 @@ impl Executor {
149149
}
150150

151151
pub fn poll_all_tasks(&mut self) {
152+
let mut completed = Vec::new();
153+
152154
loop {
153155
SPAWN_QUEUE.with(|queue| {
154156
self.tasks.append(&mut queue.borrow_mut());
155157
});
156158

157159
let mut ctx = Context::from_waker(noop_waker_ref());
158-
let mut completed = Vec::new();
159160

160161
for i in 0..self.tasks.len() {
161162
if let Poll::Ready(()) = self.tasks[i].as_mut().poll(&mut ctx) {
@@ -165,6 +166,7 @@ impl Executor {
165166

166167
// tasks can spawn more tasks
167168
let should_break = SPAWN_QUEUE.with(|queue| {
169+
let queue = queue.borrow();
168170
queue.is_empty()
169171
});
170172
if should_break {

0 commit comments

Comments
 (0)