diff options
author | David Robillard <d@drobilla.net> | 2022-08-18 16:57:17 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-08-18 16:57:17 -0400 |
commit | 0c001d5c7fd4c6c5d9ceeb55ba5fac1780b441af (patch) | |
tree | 7e42a1e6ac699fd7c59ad3dfcd4c7c5be2818c75 /test/test_ring.c | |
parent | b9d58f74ea1d072e7a2d1c862dc7a1e0fe5fccb0 (diff) | |
download | zix-0c001d5c7fd4c6c5d9ceeb55ba5fac1780b441af.tar.gz zix-0c001d5c7fd4c6c5d9ceeb55ba5fac1780b441af.tar.bz2 zix-0c001d5c7fd4c6c5d9ceeb55ba5fac1780b441af.zip |
Fix or remove non-portable features in thread API
Thread function return values are inconsistent between nearly every threading
API out there. So, just ignore them entirely, and provide a typedef and
sentinel value so user code can be portable.
Diffstat (limited to 'test/test_ring.c')
-rw-r--r-- | test/test_ring.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/test/test_ring.c b/test/test_ring.c index 79aa0f1..8016910 100644 --- a/test/test_ring.c +++ b/test/test_ring.c @@ -43,7 +43,8 @@ cmp_msg(const int* const msg1, const int* const msg2) return 1; } -static void* +ZIX_THREAD_FUNC +static ZixThreadResult reader(void* ZIX_UNUSED(arg)) { printf("Reader starting\n"); @@ -63,10 +64,11 @@ reader(void* ZIX_UNUSED(arg)) } printf("Reader finished\n"); - return NULL; + return ZIX_THREAD_RESULT; } -static void* +ZIX_THREAD_FUNC +static ZixThreadResult writer(void* ZIX_UNUSED(arg)) { printf("Writer starting\n"); @@ -82,7 +84,7 @@ writer(void* ZIX_UNUSED(arg)) } printf("Writer finished\n"); - return NULL; + return ZIX_THREAD_RESULT; } static int @@ -108,8 +110,8 @@ test_ring(const unsigned size) ZixThread writer_thread; // NOLINT assert(!zix_thread_create(&writer_thread, MSG_SIZE * 4UL, writer, NULL)); - zix_thread_join(reader_thread, NULL); - zix_thread_join(writer_thread, NULL); + assert(!zix_thread_join(reader_thread)); + assert(!zix_thread_join(writer_thread)); assert(!read_error); assert(ring); |