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 <andypython@protonmail.com>
This commit is contained in:
Anhad Singh
2024-12-05 16:24:10 +11:00
parent 55ba8d8f6b
commit a527cc53ea
+3 -1
View File
@@ -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);