summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2018-10-25 00:05:11 -0700
committerOri Bernstein <ori@eigenstate.org>2018-10-25 00:05:33 -0700
commit06f83c93631d8af9eb25199a8229183c48b89ce8 (patch)
tree460501f1d8956dc63a174904b6319f1300daa94b
parent4d6ba69e91ccaa8c3f089aa2ecfd37042350d101 (diff)
downloadmc-06f83c93631d8af9eb25199a8229183c48b89ce8.tar.gz
Heapify closures on OSX/FreeBSD.
Fixes tests. (Thanks, iri)
-rw-r--r--lib/thread/spawn+freebsd.myr2
-rw-r--r--lib/thread/spawn+osx.myr2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/thread/spawn+freebsd.myr b/lib/thread/spawn+freebsd.myr
index 66a28bd..2b327c7 100644
--- a/lib/thread/spawn+freebsd.myr
+++ b/lib/thread/spawn+freebsd.myr
@@ -55,6 +55,7 @@ const initstk = {stk, fn, sz
hdr = (tos : tlshdr#)
hdr.base = stk
hdr.stksz = sz
+ fn = std.fndup(fn)
var fn1 = {
/*
@@ -65,6 +66,7 @@ const initstk = {stk, fn, sz
hdr.len = len
setfsbase(hdr)
fn()
+ std.fnfree(fn)
}
envsz = std.fnenvsz(fn1)
diff --git a/lib/thread/spawn+osx.myr b/lib/thread/spawn+osx.myr
index 3e6ed16..1997df4 100644
--- a/lib/thread/spawn+osx.myr
+++ b/lib/thread/spawn+osx.myr
@@ -68,10 +68,12 @@ const initstk = {stk, fn, sz
hdr.len = len
hdr.base = stk
hdr.stksz = sz
+ fn = std.fndup(fn)
var fn1 = {
setgsbase(hdr)
fn()
+ std.fnfree(fn)
}
envsz = std.fnenvsz(fn1)