From 187945d0d458615f82a425c561d3918e29a50b45 Mon Sep 17 00:00:00 2001 From: Mitya Selivanov Date: Thu, 6 Jun 2024 13:22:35 +0200 Subject: [build] debug --- source/tests/test_interprocess.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/tests') diff --git a/source/tests/test_interprocess.c b/source/tests/test_interprocess.c index ee25324..7655192 100644 --- a/source/tests/test_interprocess.c +++ b/source/tests/test_interprocess.c @@ -34,6 +34,8 @@ int run_writer() { p->state = STATE_INIT; unique_unlock(&p->m); + thrd_yield(); + unique_lock(&p->m); for (int i = 0; i < DATA_SIZE; i++) p->bytes[i] = i; p->state = STATE_READY; @@ -97,6 +99,15 @@ int run_reader() { shared_lock(&p->m); while (p->state != STATE_READY) { shared_unlock(&p->m); + + struct timespec t1; + timespec_get(&t1, TIME_UTC); + + if (t1.tv_sec - t0.tv_sec > TIMEOUT) { + printf("%s: timeout.\n", __FUNCTION__); + return 1; + } + thrd_yield(); shared_lock(&p->m); } -- cgit v1.2.3