diff options
author | Ori Bernstein <ori@eigenstate.org> | 2016-05-12 20:22:23 -0400 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2016-05-12 20:35:04 -0400 |
commit | bccdc9c4492e0270322b0b0ab81fa509c5390ab2 (patch) | |
tree | b263c55acb7964ced493ee2d5d5efcec991ef73b /lib/thread | |
parent | 107e78e61117bdadc667fb5bdece373b90a26015 (diff) | |
download | mc-bccdc9c4492e0270322b0b0ab81fa509c5390ab2.tar.gz |
Install thread hooks in libstd
Looks like the file wasn't properly added.
Diffstat (limited to 'lib/thread')
-rw-r--r-- | lib/thread/bld.sub | 1 | ||||
-rw-r--r-- | lib/thread/hookstd.myr | 23 |
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/thread/bld.sub b/lib/thread/bld.sub index 35cc5a6..8eb8457 100644 --- a/lib/thread/bld.sub +++ b/lib/thread/bld.sub @@ -1,5 +1,6 @@ lib thread = common.myr + hookstd.myr # install thread hooks # linux impl of basic thread primitives #condvar+linux.myr diff --git a/lib/thread/hookstd.myr b/lib/thread/hookstd.myr new file mode 100644 index 0000000..de83178 --- /dev/null +++ b/lib/thread/hookstd.myr @@ -0,0 +1,23 @@ +use std +use "mutex" + +pkg thread = +;; + +var memlck +var netlck +var envlck + +const __init__ = { + memlck = mkmtx() + netlck = mkmtx() + envlck = mkmtx() + std.__lockinit( \ + &memlck castto(void#), \ + &netlck castto(void#), \ + &envlck castto(void#), \ + {mtx; mtxlock(mtx castto(mutex#))}, \ + {mtx; mtxunlock(mtx castto(mutex#))} \ + ) +} + |