MacroPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Minimal update since 8.2 release.
8.1 version

with-process-lock

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 ...))

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-2016, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 8.1 page.
Created 2010.1.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 8.2
Minimal update since 8.2 release.
8.1 version