shithub: mc

ref: 765ff439ba6b29b36c6df8ea3923fac9f5e39eaf
dir: /lib/thread/hookstd.myr/

View raw version
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#))} \
	)
}