mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-01 15:51:12 +00:00
Don't store worker handles
This commit is contained in:
parent
4968cd861e
commit
29b76965fe
1 changed files with 2 additions and 13 deletions
|
@ -340,7 +340,6 @@ fn load_deps<'a>(
|
||||||
unsolved_modules: MutMap::default(),
|
unsolved_modules: MutMap::default(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut worker_handles = bumpalo::collections::Vec::with_capacity_in(num_workers, arena);
|
|
||||||
let mut worker_listeners = bumpalo::collections::Vec::with_capacity_in(num_workers, arena);
|
let mut worker_listeners = bumpalo::collections::Vec::with_capacity_in(num_workers, arena);
|
||||||
|
|
||||||
for _ in 0..num_workers {
|
for _ in 0..num_workers {
|
||||||
|
@ -355,7 +354,7 @@ fn load_deps<'a>(
|
||||||
let main_task_queue = &main_task_queue;
|
let main_task_queue = &main_task_queue;
|
||||||
|
|
||||||
// Record this thread's handle so the main thread can join it later.
|
// Record this thread's handle so the main thread can join it later.
|
||||||
worker_handles.push(thread_scope.spawn(move |_| {
|
thread_scope.spawn(move |_| {
|
||||||
// Keep listening until we receive a Shutdown msg
|
// Keep listening until we receive a Shutdown msg
|
||||||
for msg in worker_msg_rx.iter() {
|
for msg in worker_msg_rx.iter() {
|
||||||
match msg {
|
match msg {
|
||||||
|
@ -392,7 +391,7 @@ fn load_deps<'a>(
|
||||||
// Needed to prevent a borrow checker error about this closure
|
// Needed to prevent a borrow checker error about this closure
|
||||||
// outliving its enclosing function.
|
// outliving its enclosing function.
|
||||||
drop(worker_msg_rx);
|
drop(worker_msg_rx);
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// We've now distributed one worker queue to each thread.
|
// We've now distributed one worker queue to each thread.
|
||||||
|
@ -465,16 +464,6 @@ fn load_deps<'a>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Join all the threads we created earlier, so we don't exit until
|
|
||||||
// they all do. They'll exit when we send them Shutdown messages,
|
|
||||||
// which `update` will do once all processing has been completed.
|
|
||||||
for handle in worker_handles {
|
|
||||||
// TODO can we not do this?
|
|
||||||
handle
|
|
||||||
.join()
|
|
||||||
.map_err(|_| LoadingProblem::ErrJoiningWorkerThreads)?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The msg_rx receiver closed unexpectedly before we finished solving everything
|
// The msg_rx receiver closed unexpectedly before we finished solving everything
|
||||||
Err(LoadingProblem::MsgChannelDied)
|
Err(LoadingProblem::MsgChannelDied)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue