summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorromir kulshrestha <romir.kulshrestha@gmail.com> 2026-03-04 22:52:10 +0100
committerromir kulshrestha <romir.kulshrestha@gmail.com> 2026-03-04 22:52:10 +0100
commitd8abc58590eb3f0e61fb3b9eb1d79597ca8a45ca (patch)
treeba088220fa62e621a0391f34fcbcb9189c59a12e
parente6bf313e419592860ed5087cb76f1261e7a7060c (diff)
maybe race condition fix?
-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;
}
}
}