diff options
Diffstat (limited to 'oryxc')
| -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(); } } } |