Skip to content

Commit

Permalink
unix: test uv_barrier_t size in right block (libuv#4311)
Browse files Browse the repository at this point in the history
The local uv_barrier_t implementation is used: for AIX, OpenBSD and any system
not defining PTHREAD_BARRIER_SERIAL_THREAD.

As the uv_barrier_t struct was modified and it isn't a pointer anymore, the
check for uv_barrier_t size isn't right anymore for systems not using local
uv_barrier_t implementation. so move the check inside the block implementing
uv_barrier_t using pthread_barrier_t.

Tested on OpenBSD, where the build failed due to the STATIC_ASSERT().
  • Loading branch information
semarie authored Feb 12, 2024
1 parent 29a708a commit 76f7fb2
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/thread-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include <pthread.h>
#endif

#if defined(PTHREAD_BARRIER_SERIAL_THREAD)
STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t));
#endif

/* Note: guard clauses should match uv_barrier_t's in include/uv/unix.h. */
#if defined(_AIX) || \
defined(__OpenBSD__) || \
Expand Down Expand Up @@ -113,6 +109,8 @@ void uv_barrier_destroy(uv_barrier_t* barrier) {

#else

STATIC_ASSERT(sizeof(uv_barrier_t) == sizeof(pthread_barrier_t));

int uv_barrier_init(uv_barrier_t* barrier, unsigned int count) {
return UV__ERR(pthread_barrier_init(barrier, NULL, count));
}
Expand Down

0 comments on commit 76f7fb2

Please sign in to comment.