From 12a2a85e25578f8a2623c44150fb7e38615bc465 Mon Sep 17 00:00:00 2001
From: Benoit Germain
- This document was revised on 22-Oct-13, and applies to version 3.7.1. + This document was revised on 16-Nov-13, and applies to version 3.7.2.
@@ -1189,17 +1189,21 @@ events to a common Linda, but... :).lock_func = lanes.genlock( linda_h, key [,N_uint=1]) - lock_func( M_uint ) -- acquire + bool = lock_func( M_uint [, "try"] ) -- acquire .. - lock_func( -M_uint ) -- release + bool = lock_func( -M_uint) -- release |
- The generated function acquires M entries from the N available, or releases them if the value is negative. The acquiring call will suspend the lane, if necessary. Use M=N=1 for a critical section lock (only one lane allowed to enter).
+ The generated function acquires M tokens from the N available, or releases them if the value is negative. The acquiring call will suspend the lane, if necessary. Use M=N=1 for a critical section lock (only one lane allowed to enter).
+
+ When passsing "try" as second argument when acquiring, then lock_func operates on the linda with a timeout of 0 to emulate a TryLock() operation. If locking fails, lock_func returns false. "try" is ignored when releasing (as it it not expected to ever have to wait unless the acquisition/release pairs are not properly matched).
+
+ Upon successful lock/unlock, lock_func returns true (always the case when block-waiting for completion).
- Note: The locks generated are not recursive. That would need another kind of generator, which is currently not implemented. + Note: The generated locks are not recursive (A single lane locking several times will consume tokens at each call, and can therefore deadlock itself). That would need another kind of generator, which is currently not implemented.
-- cgit v1.2.3-55-g6feb