summaryrefslogtreecommitdiff
path: root/man/2/lock
diff options
context:
space:
mode:
authorCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
committerCharles.Forsyth <devnull@localhost>2006-12-22 20:52:35 +0000
commit46439007cf417cbd9ac8049bb4122c890097a0fa (patch)
tree6fdb25e5f3a2b6d5657eb23b35774b631d4d97e4 /man/2/lock
parent37da2899f40661e3e9631e497da8dc59b971cbd0 (diff)
20060303-partial
Diffstat (limited to 'man/2/lock')
-rw-r--r--man/2/lock39
1 files changed, 39 insertions, 0 deletions
diff --git a/man/2/lock b/man/2/lock
new file mode 100644
index 00000000..ff9a0fa7
--- /dev/null
+++ b/man/2/lock
@@ -0,0 +1,39 @@
+.TH LOCK 2
+.SH NAME
+lock \-
+thread locking.
+.SH SYNOPSIS
+.EX
+include "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 Lock
+provides semaphore-based mutual exclusion.
+.B Init
+must 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 s
+and allows processes waiting on it to proceed.
+.SH SOURCE
+.B /appl/lib/lock.b
+