with-timeoutPortable Threadswithout-lock-heldGoTo Top

without-lock-held   (lock &key whostate) form* => result*[Macro]

Purpose
Temporarily release a lock or a recursive lock, execute forms and then reacquire the lock.

Package   :portable-threads

Module   :portable-threads

Arguments and values

lock     A lock, a recursive lock, or a condition variable
whostate     A string (default "Without Lock Held")
forms     An implicit progn of forms to be evaluated
results     The values returned by evaluating the last form

Returns
The values returned by evaluating the last form.

Errors
A thread attempts to release a lock that it does not hold.

See also
    make-condition-variable
    make-lock
    make-recursive-lock
    thread-holds-lock-p
    thread-whostate
    with-lock-held

Example
Acquire and temporarily release a lock controlling access to several critical sections of code:

  (with-lock-held (lock :whostate "Waiting for Critical Lock")
    (critical-section-1)
    (without-lock-held (lock :whostate "Doing non-critical stuff")
      (non-critical-section))
    (critical-section-2))

Note
The whostate value is ignored by SBCL.


The GBBopen Project


with-timeoutPortable Threadswithout-lock-heldGoTo Top