summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--oryxc/src/compiler.rs7
2 files changed, 8 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 14e38dd..72e2ff5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
target/
unigen/data/
+.idea/
diff --git a/oryxc/src/compiler.rs b/oryxc/src/compiler.rs
index 4ae8577..f630166 100644
--- a/oryxc/src/compiler.rs
+++ b/oryxc/src/compiler.rs
@@ -195,6 +195,10 @@ fn worker_loop(
}
let Some(job) = find_task(&queue, &state.globalq, &stealers) else {
+ // no work available; check termination condition before parking to avoid missed wakeups
+ if state.njobs.load(Ordering::Acquire) == 0 {
+ break;
+ }
thread::park();
continue;
};
@@ -258,6 +262,9 @@ fn worker_loop(
// njobs is 0; wake all threads so they can observe the termination
// condition and exit.
state.wake_all();
+
+ // break here to avoid unnecessary steal attempts after work is done.
+ break;
}
}
}