ref: 6b84c3a6548f1c577948763b0a09a7b6e2460e04
dir: /appl/lib/lock.b/
implement Lock;
include "sys.m";
sys: Sys;
include "lock.m";
Semaphore.obtain(l: self ref Semaphore)
{
l.c <-= 0;
}
Semaphore.release(l: self ref Semaphore)
{
<-l.c;
}
Semaphore.new(): ref Semaphore
{
l := ref Semaphore;
l.c = chan[1] of int;
return l;
}
init()
{
}