summaryrefslogtreecommitdiff
path: root/lib/thread
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-04-09 02:27:03 -0700
committerOri Bernstein <ori@eigenstate.org>2017-04-09 02:27:29 -0700
commita0b36b8060d9ed6ee7f80bf771f81ca2c056e260 (patch)
tree350644d7c4a99b1993468577fdffa4aef3aceb97 /lib/thread
parent4078e565e99dfb4abf07df16f0317c85a6bca3f1 (diff)
downloadmc-a0b36b8060d9ed6ee7f80bf771f81ca2c056e260.tar.gz
Move plan9 fndup before fork.
Diffstat (limited to 'lib/thread')
-rw-r--r--lib/thread/spawn+plan9.myr6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/thread/spawn+plan9.myr b/lib/thread/spawn+plan9.myr
index babcf02..d79731a 100644
--- a/lib/thread/spawn+plan9.myr
+++ b/lib/thread/spawn+plan9.myr
@@ -8,13 +8,15 @@ pkg thread =
;;
const spawn = {fn
+ fn = std.fndup(fn)
match sys.rfork(sys.Rfproc | sys.Rfmem | sys.Rfnowait)
| 0:
- fn = std.fndup(fn)
fn()
std.fnfree(fn)
std.exit(0)
- | -1: -> `std.Err "unable to spawn thread"
+ | -1:
+ std.fnfree(fn)
+ -> `std.Err "unable to spawn thread"
| thr: -> `std.Ok (thr : tid)
;;
}