From 76f7fb26b9ac8ede4406fa786acb7480d9b48ff5 Mon Sep 17 00:00:00 2001 From: Sebastien Marie <8948701+semarie@users.noreply.github.com> Date: Mon, 12 Feb 2024 09:58:28 +0100 Subject: [PATCH] unix: test uv_barrier_t size in right block (#4311) 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(). --- src/thread-common.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/thread-common.c b/src/thread-common.c index ee8a9fcf8d0..a6c914f4a5d 100644 --- a/src/thread-common.c +++ b/src/thread-common.c @@ -27,10 +27,6 @@ #include #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__) || \ @@ -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)); }