diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 19:11:09 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 19:24:19 -0400 |
commit | 8b2d6a7f282398aafc8449a625441cc87bbd6c9e (patch) | |
tree | ff11e264ccae305a7fc2656b35d105c1bf7b7d09 /test | |
parent | 93eb717f520d68d27bfe110d48057cdd54a4a2bc (diff) | |
download | zix-8b2d6a7f282398aafc8449a625441cc87bbd6c9e.tar.gz zix-8b2d6a7f282398aafc8449a625441cc87bbd6c9e.tar.bz2 zix-8b2d6a7f282398aafc8449a625441cc87bbd6c9e.zip |
Add zix_sem_timed_wait()
Diffstat (limited to 'test')
-rw-r--r-- | test/test_sem.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/test_sem.c b/test/test_sem.c index d43dac8..36f85e0 100644 --- a/test/test_sem.c +++ b/test/test_sem.c @@ -52,6 +52,19 @@ test_try_wait(void) assert(!zix_sem_destroy(&sem)); } +static void +test_timed_wait(void) +{ + assert(!zix_sem_init(&sem, 0)); + assert(zix_sem_timed_wait(&sem, 0, 0) == ZIX_STATUS_TIMEOUT); + assert(zix_sem_timed_wait(&sem, 0, 5000000) == ZIX_STATUS_TIMEOUT); + assert(!zix_sem_post(&sem)); + assert(!zix_sem_timed_wait(&sem, 0, 5000000)); + assert(!zix_sem_post(&sem)); + assert(!zix_sem_timed_wait(&sem, 1000, 0)); + assert(!zix_sem_destroy(&sem)); +} + int main(int argc, char** argv) { @@ -65,6 +78,7 @@ main(int argc, char** argv) } test_try_wait(); + test_timed_wait(); printf("Testing %u signals...\n", n_signals); |