Skip to content

Test coordination primitives

include/test/sync.h View source View on GitHub
struct test_latch (1 field) source

Just a wrapper around event_latch. Someday we could

But we only really need an event_latch for “correctness”

TODO

add metadata and tracking around this.

§ struct event_latch el
struct test_phase (4 fields) source

This effectively serves as the

while (atomic_load(&v->phase) != n)
scheduler_yield();

pattern that tests like, with a poison bool to tell it to end

§ struct spinlock lock
§ struct condvar cv
§ atomic_bool poisoned
void test_latch_init(struct test_latch *l)
source
void test_latch_set(struct test_latch *l)
source
bool test_latch_test(const struct test_latch *l)
source
bool test_latch_wait_timeout(
    struct test_latch *l,
    time_ms_t timeout_ms
)
source
bool test_latch_spin_timeout(
    struct test_latch *l,
    time_ms_t timeout_ms
)
source
void test_phase_init(struct test_phase *p)
source
uint32_t test_phase_get(const struct test_phase *p)
source
void test_phase_publish(struct test_phase *p, uint32_t phase)
source
void test_phase_set(struct test_phase *p, uint32_t phase)
source
void test_phase_advance(struct test_phase *p)
source
bool test_phase_is_poisoned(const struct test_phase *p)
source
void test_phase_poison(struct test_phase *p)
source