1implement Lock; 2 3include "sys.m"; 4 sys: Sys; 5include "lock.m"; 6 7Semaphore.obtain(l: self ref Semaphore) 8{ 9 l.c <-= 0; 10} 11 12Semaphore.release(l: self ref Semaphore) 13{ 14 <-l.c; 15} 16 17Semaphore.new(): ref Semaphore 18{ 19 l := ref Semaphore; 20 l.c = chan[1] of int; 21 return l; 22} 23 24init() 25{ 26} 27