7#include "../testing.hh"
13semaphore_multiple_test()
23 TCHECK (sem.
wait() == 0,
"First sem.wait() should succeed");
24 TCHECK (sem.
wait() == 0,
"Second sem.wait() should succeed");
28 TCHECK (ret != 0,
"Third sem.wait_for() should timeout");
34semaphore_concurrent_test()
64 TCHECK (waiter1_done && waiter2_done,
"Both waiters should complete");
65 TCHECK ((waiter1_ret == 0) != (waiter2_ret == 0),
"Exactly one waiter should succeed");
int wait() noexcept
Wait indefinitely for ScopedSemaphore.
int wait_for(uint64_t useconds) noexcept
Wait for ScopedSemaphore with timeout (microseconds).
int post() noexcept
Unlock ScopedSemaphore.
The Anklang C++ API namespace.
#define TEST_ADD(fun)
Register a function to run as part of the unit test suite.
#define TCHECK(cond,...)
Verbose assertion, calls TPASS() on success./*#end#*/.