Handbook
Glossary
with-lock ( lock quot -- )
Locks
ยป
Mutual-exclusion locks
Prev:
<reentrant-lock> ( -- lock )
Next:
with-lock-timeout ( lock timeout quot -- )
Vocabulary
concurrency
.
locks
Inputs
lock
a
lock
quot
a
quotation
Outputs
None
Word description
Calls the quotation, ensuring that only one thread executes with the lock held at a time. If another thread is holding the lock, blocks until the thread releases the lock.
Definition
USING:
kernel
;
IN:
concurrency.locks
:
with-lock
( lock quot -- )
f
swap
with-lock-timeout
;
inline