Updated at July 17, 2026 02:08 PM
Module latch
A lock for cooperative multitasking environment
Allocate and initialize the new latch.
Returns
allocated latch object
Return type
box_latch_t *
Destroy and free the latch.
Parameters:
latch(box_latch_t*) — latch to destroy
Lock a latch. Waits indefinitely until the current fiber can gain access to the latch. Since version 2.11.0, locks are acquired exactly in the order in which they were requested.
latch(box_latch_t*) — latch to lock
Try to lock a latch. Return immediately if the latch is locked.
latch(box_latch_t*) — latch to lock
Returns
status of operation. 0 - success, 1 - latch is locked
Return type
int
Unlock a latch. The fiber calling this function must own the latch.
latch(box_latch_t*) — latch to unlock