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

NextPrevUpTopContentsIndex

lock-and-condition-variable-signal

Function
Summary

Locks, applies a setup function, calls condition-variable-signal and unlocks.

Package

mp

Signature

lock-and-condition-variable-signal lock condvar lock-timeout setup-function &rest args => signaledp

Arguments

lock

A lock.

condvar

A condition-variable.

lock-timeout

A non-negative real or nil.

setup-function

A function designator.

args

Arguments to setup-function.

Values

signaledp

A generalized boolean.

Description

The function lock-and-condition-variable-signal locks the lock lock, applies setup-function to args, calls condition-variable-signal and unlocks lock. lock-and-condition-variable-signal makes it easier to avoid mistakes when using a condition-variable.

lock-and-condition-variable-signal performs the equivalent of:

(mp:with-lock (lock
 nil lock-timeout
)
  (apply setup-function
 args
)
  (mp:condition-variable-signal condvar
))

It returns the result of the call to condition-variable-signal.

See condition-variable-signal and with-lock for more details.

Notes

setup-function is called with lock held, so it should do the minimum amount of work and avoid locking other locks. Normally setup-function should only set the cell that the process(es) that wait(s) on the condition-variable condvar check with the predicate in lock-and-condition-variable-wait.

See also

lock-and-condition-variable-wait
simple-lock-and-condition-variable-wait
lock-and-condition-variable-broadcast
condition-variable-wait
condition-variable-signal
condition-variable-broadcast
Condition variables
Locks


LispWorks User Guide and Reference Manual - 20 Sep 2017

NextPrevUpTopContentsIndex