From a527cc53eafb1b35a48629bc2b6dae283453fc60 Mon Sep 17 00:00:00 2001 From: Anhad Singh Date: Thu, 5 Dec 2024 16:24:10 +1100 Subject: [PATCH] tests(pthread): status must be 0 if not leader Fix CI break. man pthread_barrier_wait(3) > ...the constant PTHREAD_BARRIER_SERIAL_THREAD shall be returned to > one *unspecified* thread and zero shall be returned to each of the remaining > threads. Signed-off-by: Anhad Singh --- tests/pthread/barrier.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/pthread/barrier.c b/tests/pthread/barrier.c index ace032f871..34be540015 100644 --- a/tests/pthread/barrier.c +++ b/tests/pthread/barrier.c @@ -22,7 +22,9 @@ void *routine(void *arg_raw) { int status = pthread_barrier_wait(arg->barrier); arg->is_leader = status == PTHREAD_BARRIER_SERIAL_THREAD; - ERROR_IF(pthread_barrier_wait, status, != 0); + + if (!arg->is_leader) + ERROR_IF(pthread_barrier_wait, status, != 0); // We can now modify the counter. atomic_fetch_add_explicit(arg->count, 1, memory_order_relaxed);