| Allegro CL version 10.1 Minimal update since the initial 10.1 release. 10.0 version |
Arguments: (lock &key timeout norecursive seized whostate) &body body
This macro executes the body with lock
seized. Unlike process-lock,
with-process-lock protects
against a single process trying to seize a lock it already owns. If
executed dynamically inside another with-process-lock for the same lock, and if
norecursive is nil
,
with-process-lock behaves as
if the lock was seized successfully, and the body is executed. If
norecursive is t
, an
error is signaled. The default value of
norecursive is nil
.
If a timeout is specified and
non-nil
, the value should be an integer; the
units are seconds. Non-positive timeout values time out immediately. A
value of nil
is equivalent to an unspecified
timeout argument.
If the form times out before the lock is available, the
with-process-lock form returns
nil
without the body being executed. If you
want to take specific action if the lock does not become available
when timeout is specified, use a form like this:
(block ok (with-process-lock (lock :timeout 10) (return-from ok (progn body-forms ...))) (... action if lock never becomes available ...))
If there is a non-local exit from body. the release of the lock is taken care of in an unwind-protect.
See also process-unlock, process-lock-locker, and make-process-lock.
See About design considerations for event-driven applications in cgide.htm and post-funcall-in-cg-process if you intend to call this function is a Common Graphics process.
See multiprocessing.htm for general information on multiprocessing in Allegro CL and see Process locks for more information on process locks in Allegro CL.
Copyright (c) 1998-2022, Franz Inc. Lafayette, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2019.8.20.
| Allegro CL version 10.1 Minimal update since the initial 10.1 release. 10.0 version |