NextPrevUpTopContentsIndex

with-lock

Macro
Summary

Executes a body of code while holding a lock.

Package

mp

Signature

with-lock ( lock &rest lock-args ) &body body => result

Arguments

lock

The lock.

lock-args

These are the optional arguments used by process-lock : whostate (the status of the process while the lock is locked, as seen in the Process Browser) and timeout (a timeout period, in seconds).

body

The forms to execute.

Values

result

The result of executing body .

Description

with-lock executes body while holding the lock, and unlocks the lock when body exits. This is the recommended way of using locks. The value of body is returned normally. body is not executed if the lock could not be claimed, in which case, with-lock returns nil .

See also

create-simple-process
make-lock
process-lock
process-unlock
schedule-timer


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex