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

NextPrevUpTopContentsIndex

with-exclusive-lock

Macro
Summary

Holds a sharing lock in exclusive mode while evaluating its body, and then unlocks the lock.

Package

mp

Signature

with-exclusive-lock ( sharing-lock &optional whostate timeout ) &body body => results

Arguments

sharing-lock

A sharing lock.

whostate

The status of the process while the lock is locked, as seen in the Process Browser.

timeout

A timeout period, in seconds.

body

The forms to execute

Values

results

The values returned from evaluating body.

Description

The macro with-exclusive-lock is the same as with-lock, except that the lock must be "sharing", that is, created with the argument sharing true in make-lock. It waits until sharing-lock is completely free, that is, the lock is not locked in a sharing mode and is not locked in exclusive mode by another thread. It then locks the lock sharing-lock in exclusive mode, evaluates body and unlocks the lock.

Notes

It is not possible to use an exclusive lock in the scope of a sharing-lock on the same lock, and trying to do it will cause the process to hang. Whether it is possible to use exclusive-lock inside exclusive-lock of the same lock is determined by the recursivep argument in make-lock.

See also

make-lock
with-lock


LispWorks User Guide and Reference Manual - 21 Dec 2011

NextPrevUpTopContentsIndex