All Manuals > CLIM 2.0 User Guide > Appendix C: The CLIM-SYS Package

C.3 Locks

In the course of multi-processing, it is important to ensure that two processes do not modify the same data simultaneously. This is done by creating a lock, which is an extra memory location in a data structure that can be checked to determine whether that structure is in use. If the value of a lock is nil, no process is using the data structure; otherwise, the value should be a process that is currently using the structure.

The following symbols for creating locks will work with all CLIM ports.

with-lock-held Macro

with-lock-held (place &optional state) &body body

Summary: Evaluates body with the lock named by place. place is a reference to a lock created by make-lock. state specifies the process to store in the place location; the default value is the value of the variable *current-process*.

On systems that do not support locking, with-lock-held is equivalent to progn.

make-lock Function

make-lock &optional name

Summary: Creates a lock whose name is name. On systems that do not support locking, this will return a new list of one element, nil.

with-recursive-lock-held Macro

with-recursive-lock-held (place &optional state) &body body

Summary: Evaluates body with the recursive lock named by place. place is a reference to a recursive lock created by make-recursive-lock. A recursive lock differs from an ordinary lock in that a process that already holds the recursive lock can call with-recursive-lock-held on the same lock without blocking.

On systems that do not support locking, with-recursive-lock-held is equivalent to progn.

make-recursive-lock Function

make-recursive-lock &optional name

Summary: Creates a recursive lock whose name is name. On systems that do not support locking, this will return a new list of one element, nil.


CLIM 2.0 User Guide - 01 Dec 2021 19:39:02