ref: f8152dae21873cf42f2d65bdf657a717c2240a25
parent: bccdc9c4492e0270322b0b0ab81fa509c5390ab2
author: Ori Bernstein <ori@eigenstate.org>
date: Thu May 12 16:37:51 EDT 2016
Exercise some of the allocation/put locking.
--- a/lib/std/alloc.myr
+++ b/lib/std/alloc.myr
@@ -253,7 +253,7 @@
bkt = &buckets[bktnum(sz)]
lock(memlck)
bktfree(bkt, p)
- lock(memlck)
+ unlock(memlck)
else
freemem(p, sz)
;;
--- a/lib/thread/test/mutex.myr
+++ b/lib/thread/test/mutex.myr
@@ -18,15 +18,16 @@
while thread.xget(&done) != Nherd
/* nothing */
;;
- if val != 10_000 * 20
+ if val != 1000 * 20
std.fatal("mutexes are broken, got {}\n", val)
;;
}
const incvar = {
- for var i = 0; i < 10_000; i++
+ for var i = 0; i < 1000; i++
thread.mtxlock(&mtx)
val++
+ std.put("val: {}\n", val)
thread.mtxunlock(&mtx)
;;
thread.xadd(&done, 1)