ref: 3d9ce334368f0d6e7da472200c68c7081889058b
parent: bb9114fe7f070794477f0cd0f907dcf709c3fd8b
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Nov 20 17:37:48 EST 2016
Add ncpu for 9front.
--- a/lib/thread/bld.sub
+++ b/lib/thread/bld.sub
@@ -25,6 +25,7 @@
#condvar+plan9.myr
mutex+plan9.myr
spawn+plan9.myr
+ ncpu+plan9.myr
atomic-impl+plan9-x64.s
# openbsd impl of thread primitives
--- /dev/null
+++ b/lib/thread/ncpu+plan9.myr
@@ -1,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
+ ;;
+}