diff options
| author | romir kulshrestha <romir.kulshrestha@gmail.com> | 2026-03-04 20:09:27 +0100 |
|---|---|---|
| committer | romir kulshrestha <romir.kulshrestha@gmail.com> | 2026-03-04 20:09:27 +0100 |
| commit | b678c18b38a4ae0b446a19df3929057dcb210d06 (patch) | |
| tree | 264ed1374f0cdf481b41a545f15220f603129f61 /oryxc/src/compiler.rs | |
| parent | 9d0c4a673036e48b4d8a455eb468806e9087fb4e (diff) | |
wake_all() util
Diffstat (limited to 'oryxc/src/compiler.rs')
| -rw-r--r-- | oryxc/src/compiler.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/oryxc/src/compiler.rs b/oryxc/src/compiler.rs index a83cf45..b806a9e 100644 --- a/oryxc/src/compiler.rs +++ b/oryxc/src/compiler.rs @@ -87,14 +87,18 @@ pub struct CompilerState { } impl CompilerState { - fn push_job(&self, queue: &Worker<Job>, job: Job) { - queue.push(job); + fn wake_all(&self) { if let Some(threads) = self.worker_threads.get() { for t in threads.iter() { t.unpark(); } } } + + fn push_job(&self, queue: &Worker<Job>, job: Job) { + queue.push(job); + self.wake_all(); + } } pub fn start<T>(paths: T, flags: Flags) @@ -233,11 +237,7 @@ fn worker_loop( if state.njobs.fetch_sub(1, Ordering::Release) == 1 { // njobs is 0; wake all threads so they can observe the termination // condition and exit. - if let Some(threads) = state.worker_threads.get() { - for t in threads.iter() { - t.unpark(); - } - } + state.wake_all(); } } } |