NextPrevUpTopContentsIndex

process-lock

Function
Summary

Claims the lock for the current process.

Package

mp

Signature

process-lock lock &optional whostate timeout => bool

Arguments

lock

A lock object (see make-lock).

whostate

The status of the current Lisp process, before process-lock returns, that is, the status while the current process is waiting to timeout. This can be seen in the Process Browser.

timeout

A timeout interval, in seconds. If this is not given, process-lock waits until the lock can be set by the current Lisp process. A process can set a lock more than once.

Values

result

A boolean.

Description

process-lock attempts to lock lock and returns t if successful, or nil if timed out. If lock is already locked and the owner of the lock is the value of *current-process*, then lock remains locked and an internal count is incremented. The Lisp process sleeps until the lock is claimed or the timeout period expires.

result is t if lock was successfully locked, and nil otherwise.

Example

(process-lock *my-lock* "waiting to lock" 10)

See also

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


LispWorks Reference Manual - 12 Mar 2008

NextPrevUpTopContentsIndex