MacroPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
New since 8.2 release.

with-sharable-lock

Arguments: (mode lock &key recursive-p yield-rate timeout timeout-body) &body body

Evaluate a body of code in the context of a sharable-lock acquired in the specified mode. This macro allows more control of the behavior than with-shared-lock or with-exclusive-lock. This macro is in the smputil module and may not be included in the image util (require :smputil) is evaluated.

The mode argument must evaluate to one of the keywords :exclusive or :shared.

The lock argument must evaluate to an instance of sharable-lock.

The yield-rate argument, if specified, must evaluate to a positive integer, or the keyword :never. The specified value overrides the value in the lock instance. If the argument is omitted, or specified as nil, than the value in the lock instance is used.

The timeout argument, if specified, must evaluate to nil or a number of seconds. The value determines how long the program will wait if the lock is not immediately available. A timeout value of zero (or a negative value) specifies that that the lock must be available immediately only.

The recursive-p argument can be used to override the recursive-p specification in the sharable-lock instance. See make-sharable-lock.

The body expressions are evaluated as a progn body and the returned values are the values of the progn.

The timeout-body argument specified the behavior when a timout is requested. The timeout-body argument must be a list of expressions beginning with nil or a bound variable list. The default timeout behavior is ((x) (values nil x))

If a timeout occurs, or when timout is zero or negative and the lock is not available immediately, The first variable in the list of bound variables is bound to the reason for the timeout and the remainder of the timout-body is evaluated as a let body. The values returned by the timeout-body forms are the values returned from the with-sharable-lock form. In the event of a true timeout, the reason is always :timeout, but when timout is zero or negative, the reason may be one of the keywords returned by sharable-lock-lock.

If the timeout does not occur, the timeout-body argument is never evaluated, and the values of the body forms are returned.


Copyright (c) 1998-2012, Franz Inc. Oakland, CA., USA. All rights reserved.
Documentation for Allegro CL version 8.2. This page is new in the 8.2 release.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
New since 8.2 release.