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

process-sharing-lock Function

Summary

Like process-lock, but on a "sharing" lock.

Package

mp

Signature

process-sharing-lock sharing-lock &optional whostate timeout => result

Arguments
sharing-lock
A sharing lock.
whostate
A string or nil.
timeout
A non-negative real or nil.
Values
result
A boolean.
Description

The function process-sharing-lock is like process-lock, but sharing-lock must be a "sharing" lock and it will be locked in shared mode. That means that other threads can also lock it in shared mode.

Before locking, process-sharing-lock waits for sharing-lock to be free of any exclusive lock, but it does not check for other shared mode use of the same lock.

If whostate is non-nil, it is used as the wait reason while waiting for sharing-lock.

timeout, if non-nil, specifies the time in seconds to wait before timing out. The default value of timeout is nil.

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

Calls to process-sharing-lock should be matched by calls to process-sharing-unlock with sharing-lock. Normally with-sharing-lock is the best way to achieve this.

Notes

It is possible to lock for sharing inside the scope of a sharing lock and inside the scope of an exclusive lock.

process-sharing-lock is guaranteed to return if it locked sharing-lock, but may throw before locking, as described in 19.4.3 Guarantees and limitations when locking and unlocking.

See also

process-lock
process-sharing-unlock
with-sharing-lock
19.4 Locks


LispWorks® User Guide and Reference Manual - 01 Dec 2021 19:30:51