shithub: mc

ref: 286b40b5cc3bf80fdd2d9345dd3ea6c1abb06744
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#))} \
	)
}