MacroPackage: mpToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version


Arguments: (queue &key timeout norecursive seized whostate) &body body

This macro executes the body with the queue's lock seized. Like with-process-lock, with-locked-queue protects against a single process trying to seize a lock it already owns. If executed dynamically inside another with-locked-queue for the same queue, and if norecursive is nil, with-locked-queue 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 the seized keyword argument is specified it should name a variable (which is not bound by the with-locked-queue form). If specified, this variable is set to nil before the queue is examined, and is set to t if the queue is found to be already locked by the current thread. Unless norecursive has been specified as true, the body forms can see the value of that variable reflecting this status.

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-locked-queue 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:

;; This incomplete code sample (the suspension points must be
;; replaced with actual code) whows the use of this macro:
(block ok
  (with-locked-queue (queue :timeout 10)
    (return-from ok (progn body-forms ...)))
  (... action if lock never becomes available ...))

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

Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 10.0 page.
Created 2017.2.15.

Allegro CL version 10.1
Unrevised from 10.0 to 10.1.
10.0 version