diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2024-06-06 13:22:35 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2024-06-06 13:22:35 +0200 |
commit | 187945d0d458615f82a425c561d3918e29a50b45 (patch) | |
tree | c16d4e08744f84794f6bb87f9aedba2ce1d9eb72 /source | |
parent | 11b2dbd9bc8f094213a29ada2cfdf03e1adf936c (diff) | |
download | kit-187945d0d458615f82a425c561d3918e29a50b45.zip |
[build] debug
Diffstat (limited to 'source')
-rw-r--r-- | source/tests/test_interprocess.c | 11 |
1 files changed, 11 insertions, 0 deletions
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); } |