All Manuals > LispWorks User Guide and Reference Manual > 44 The MP Package

NextPrevUpTopContentsIndex

with-lock

Macro
Summary

Executes a body of code while holding a lock.

Package

mp

Signature

with-lock (lock &optional whostate timeout) &body body => result

Arguments

lock

The lock.

whostate

The status of the process while lock is locked, as seen in the Process Browser.

timeout

A non-negative real or nil.

body

The forms to execute.

Values

result

The result of executing body.

Description

with-lock executes body while holding lock, and unlocks lock when body exits. This is the recommended way of using a lock. The value of body is returned normally. body is not executed if lock could not be locked, in which case, with-lock returns nil. The timeout and whostate are used as specified by process-lock.

See also

make-lock
process-lock
process-unlock
with-exclusive-lock
with-sharing-lock
Locks


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex