From 4785ffe77cc36536a4bbe5eeea692da583dd003c Mon Sep 17 00:00:00 2001 From: Augustin Cavalier Date: Tue, 6 Jun 2023 15:45:31 -0400 Subject: [PATCH] pthread_barrier: Add casts to appease GCC2. --- src/system/libroot/posix/pthread/pthread_barrier.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/system/libroot/posix/pthread/pthread_barrier.cpp b/src/system/libroot/posix/pthread/pthread_barrier.cpp index 335e199e6c..8e4785b3d0 100644 --- a/src/system/libroot/posix/pthread/pthread_barrier.cpp +++ b/src/system/libroot/posix/pthread/pthread_barrier.cpp @@ -83,7 +83,7 @@ pthread_barrier_wait(pthread_barrier_t* barrier) // waiter_count < 0 means other threads are still exiting. // Lock in a loop, if necessary, until this is no longer the case. - while (atomic_get(&barrier->waiter_count) < 0) { + while (atomic_get((int32*)&barrier->waiter_count) < 0) { status_t status = barrier_lock(&barrier->mutex); if (status != B_OK) return status; @@ -91,7 +91,7 @@ pthread_barrier_wait(pthread_barrier_t* barrier) barrier_unlock(&barrier->mutex); } - if (atomic_add(&barrier->waiter_count, 1) == (barrier->waiter_max - 1)) { + if (atomic_add((int32*)&barrier->waiter_count, 1) == (barrier->waiter_max - 1)) { // We are the last one in. Lock the barrier mutex. barrier_lock(&barrier->mutex); @@ -113,7 +113,7 @@ pthread_barrier_wait(pthread_barrier_t* barrier) // Release the barrier, so that any later threads trying to acquire it wake up. barrier_unlock(&barrier->lock); - if (atomic_add(&barrier->waiter_count, 1) == -1) { + if (atomic_add((int32*)&barrier->waiter_count, 1) == -1) { // We are the last one out. Reset state and unlock. barrier->lock = B_USER_MUTEX_LOCKED; barrier_unlock(&barrier->mutex);