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

with-shared-lock

Arguments: (sharable-lock &key yield-rate timeout) &body body

This macro was part of an early implementation of sharable locks. The values returned are not consistent with other with-XXX macros in Common Lisp. (with-shared-lock returns t rather than the value of the last body form when the associated lock is acquired.) It is included for compatibility with earlier versions. The recommended macro is with-sharable-lock.

Evaluate a body of code in the context of a sharable-lock acquired in shared mode. This macro is in the smputil module and may not be included in the image until (require :smputil) is evaluated.

The yield-rate argument, if specified, must be 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 be a non-negative number of seconds. The value determines how long the program will wait if the lock is not immediately available. A timeout value of zero specifies that that the lock must be available immediately only.

The recursive-p argument may be used to override the recursion specification in the sharable-lock instance. If omitted, nil or :default, the value in the lock instance is used. Otherwise, the value must be t, one of the keywords allowed in make-sharable-lock, or a list of these keywords.

The body expressions are evaluated as a progn body. If the lock is acquired, the body forms are evaluated, and the with-shared-lock expression returns a single value, t. If the lock is not acquired, the with-shared-lock expression returns two values as described in sharable-lock-lock.

Note that the return value when the lock is acquired is not what is typically returned by with-XXX macros. t is returned, not the value of the last body form. As said at the beginning, this macro was part of an early implementation of sharable locks. It is included for compatibility with earlier versions. The recommended macro is with-sharable-lock.

See Sharable locks in smp.htm.


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.