Macro | Package: mp | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Object described on page has changed in 9.0. 8.2 version

## with-shared-lock

Arguments: (sharable-lock &key yield-rate timeout recursive-p) &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.

See multiprocessing.htm for general information on multiprocessing in Allegro CL.

Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
The object described on this page has been modified in the 9.0 release; see the Release Notes.
Created 2019.8.20.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 9.0 Object described on page has changed in 9.0. 8.2 version