summaryrefslogtreecommitdiff
path: root/lib/thread
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-11-20 22:37:48 -0800
committerOri Bernstein <ori@eigenstate.org>2016-11-20 22:37:48 -0800
commit3d9ce334368f0d6e7da472200c68c7081889058b (patch)
tree8432b69530f2e3d00d3f44c3731577d4058ab3f3 /lib/thread
parentbb9114fe7f070794477f0cd0f907dcf709c3fd8b (diff)
downloadmc-3d9ce334368f0d6e7da472200c68c7081889058b.tar.gz
Add ncpu for 9front.
Diffstat (limited to 'lib/thread')
-rw-r--r--lib/thread/bld.sub1
-rw-r--r--lib/thread/ncpu+plan9.myr12
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/thread/bld.sub b/lib/thread/bld.sub
index c99ed89..b873e2e 100644
--- a/lib/thread/bld.sub
+++ b/lib/thread/bld.sub
@@ -25,6 +25,7 @@ lib thread =
#condvar+plan9.myr
mutex+plan9.myr
spawn+plan9.myr
+ ncpu+plan9.myr
atomic-impl+plan9-x64.s
# openbsd impl of thread primitives
diff --git a/lib/thread/ncpu+plan9.myr b/lib/thread/ncpu+plan9.myr
new file mode 100644
index 0000000..25d09cb
--- /dev/null
+++ b/lib/thread/ncpu+plan9.myr
@@ -0,0 +1,12 @@
+use std
+
+pkg thread =
+ const ncpu : (-> int)
+;;
+
+const ncpu = {
+ match std.intparse(std.getenvv("NPROC", ""))
+ | `std.Some n: -> n
+ | `std.None: -> 1
+ ;;
+}