summaryrefslogtreecommitdiff
path: root/lib/thread/spawn+plan9.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2017-04-09 02:09:15 -0700
committerOri Bernstein <ori@eigenstate.org>2017-04-09 02:23:39 -0700
commit4078e565e99dfb4abf07df16f0317c85a6bca3f1 (patch)
treee4e955cfb9007391ff2872d734b4bc2521c493dd /lib/thread/spawn+plan9.myr
parent73518d58457d543258e344b96a8f4b13ccd16882 (diff)
downloadmc-4078e565e99dfb4abf07df16f0317c85a6bca3f1.tar.gz
Duplicate env on thread spawn.
Diffstat (limited to 'lib/thread/spawn+plan9.myr')
-rw-r--r--lib/thread/spawn+plan9.myr2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/thread/spawn+plan9.myr b/lib/thread/spawn+plan9.myr
index bb23c2b..babcf02 100644
--- a/lib/thread/spawn+plan9.myr
+++ b/lib/thread/spawn+plan9.myr
@@ -10,7 +10,9 @@ pkg thread =
const spawn = {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"
| thr: -> `std.Ok (thr : tid)