Module latch
-
type
box_latch_t
¶ A lock for cooperative multitasking environment
-
box_latch_t *
box_latch_new
(void)¶ Allocate and initialize the new latch.
Результат: allocated latch object Тип результата: box_latch_t *
-
void
box_latch_delete
(box_latch_t *latch)¶ Destroy and free the latch.
Параметры: - latch (box_latch_t*) – latch to destroy
-
void
box_latch_lock
(box_latch_t *latch)¶ 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
-
int
box_latch_trylock
(box_latch_t *latch)¶ Try to lock a latch. Return immediately if the latch is locked.
Параметры: - latch (box_latch_t*) – latch to lock
Результат: status of operation. 0 - success, 1 - latch is locked
Тип результата: int
-
void
box_latch_unlock
(box_latch_t *latch)¶ Unlock a latch. The fiber calling this function must own the latch.
Параметры: - latch (box_latch_t*) – latch to unlock