ref: a0b36b8060d9ed6ee7f80bf771f81ca2c056e260
parent: 4078e565e99dfb4abf07df16f0317c85a6bca3f1
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Apr 8 22:27:03 EDT 2017
Move plan9 fndup before fork.
--- a/lib/thread/spawn+plan9.myr
+++ b/lib/thread/spawn+plan9.myr
@@ -8,13 +8,15 @@
;;
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)
;;
}