forsyth20121205-174063a80cc13 years agoHistory
39 lines · 696 B · Text
RawDownload
.TH LOCK 2.SH NAMElock \-thread locking..SH SYNOPSIS.EXinclude "lock.m";lock := load Lock Lock->PATH;Semaphore: adt {	c: chan of int;	obtain: fn(s: self ref Semaphore);	release: fn(s: self ref Semaphore);	new: fn(): ref Semaphore;};init: fn();.EE.SH DESCRIPTION.B Lockprovides semaphore-based mutual exclusion..B Initmust be called before creating any locks..TP.B Semaphore.new()Creates and returns a reference to a new.B Semaphore(lock)..TP.IB s .obtain()Obtains exclusive access to the lock.IR s .It will block until it can do so..TP.IB s .release()Releases access to the lock.I sand allows processes waiting on it to proceed..SH SOURCE.B /appl/lib/lock.b