Next Prev Up Top Contents Index

make-lock

Function
Summary

Makes a lock.

Package

mp

Signature

make-lock &key important-p name lock owner count => lock

Arguments

important-p

When this is t , the lock is pushed onto the list mp:*important-locks* . Locks in this list are automatically freed when the holder process finishes.

This should be nil for locks which are managed completely by the application. It is wasteful to record all locks in a global list if there is no need to free them automatically.

This might be appropriate when two processes sharing a lock must both be running for the system to be consistent. If one process dies, then the other one kills itself. Thus the system does not need to worry about freeing the lock because no-one else could be waiting on it forever after the first process dies.

name

The name of the lock.

lock

t or nil . When lock is t , the lock is set. The default is nil .

owner

The owner of the lock.

count

The number of times the lock has been set. The default is 0.

Values

lock

The lock object.

Description

make-lock returns a lock object. See the Multiprocessing chapter of the LispWorks User Guide for a general description of locks.

Example
cl-user 4> (setq *my-lock* (mp:make-lock 
                            :name "my-lock"))
#<LOCK "my-lock" "Unlocked" NIL 0 7909676)
See also
claim-lock
process-lock
process-unlock
release-lock
with-lock

LispWorks Reference Manual - 25 Jul 2003

Next Prev Up Top Contents Index