Skip to content

Countdown latch (using events)

include/sync/event_latch.h View source View on GitHub
struct event_latch (2 fields) source
§ struct once_latch latch
§ struct event ready
void event_latch_init(struct event_latch *el, uint64_t count)
source
bool event_latch_count_down(struct event_latch *el)
source
bool event_latch_is_ready(const struct event_latch *el)
source
uint64_t event_latch_count(const struct event_latch *el)
source
void event_latch_wait(struct event_latch *el)
source
bool event_latch_wait_timeout(
    struct event_latch *el,
    time_ms_t timeout_ms
)
source
#define EVENT_LATCH_INIT(name_, n)
source
Expansion
#define EVENT_LATCH_INIT(name_, n) \
    (struct event_latch) { \
        .latch = ONCE_LATCH_INIT(n), \
        .ready = EVENT_INIT((name_).ready, EVENT_NOTIFICATION, false), \
    }