From ab34275b6cf1b685bc239dd64841881095ed3e69 Mon Sep 17 00:00:00 2001 From: Fabio Baltieri Date: Wed, 5 Jun 2024 19:26:18 +0100 Subject: [PATCH] posix: re-introduce PTHREAD_RWLOCK_INITIALIZER Rename the POSIX_RWLOCK_INITIALIZER back to PTHREAD_RWLOCK_INITIALIZER. This was changed in 70e2b02c8e1, but PTHREAD_RWLOCK_INITIALIZER is the standard name used by external libraries. Change it back to restore compatibility. (cherry picked from commit c250c330c6bf69cb3cfbd78b2c0290d2651742e0) Original-Signed-off-by: Fabio Baltieri GitOrigin-RevId: c250c330c6bf69cb3cfbd78b2c0290d2651742e0 Change-Id: Id15074993e3c3044322ecc3a0ac74c9cfd4d8cb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5602980 Tested-by: ChromeOS Prod (Robot) Tested-by: Fabio Baltieri Reviewed-by: Fabio Baltieri Commit-Queue: Fabio Baltieri --- include/zephyr/posix/pthread.h | 2 +- lib/posix/options/rwlock.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/zephyr/posix/pthread.h b/include/zephyr/posix/pthread.h index 33288d7d755..f2723d68d76 100644 --- a/include/zephyr/posix/pthread.h +++ b/include/zephyr/posix/pthread.h @@ -153,7 +153,7 @@ int pthread_condattr_setclock(pthread_condattr_t *att, clockid_t clock_id); * * Initialize a rwlock with the default rwlock attributes. */ -#define POSIX_RWLOCK_INITIALIZER (-1) +#define PTHREAD_RWLOCK_INITIALIZER (-1) /* * Mutex attributes - type diff --git a/lib/posix/options/rwlock.c b/lib/posix/options/rwlock.c index ef14867b028..f282fc26549 100644 --- a/lib/posix/options/rwlock.c +++ b/lib/posix/options/rwlock.c @@ -86,7 +86,7 @@ struct posix_rwlock *to_posix_rwlock(pthread_rwlock_t *rwlock) size_t bit; struct posix_rwlock *rwl; - if (*rwlock != POSIX_RWLOCK_INITIALIZER) { + if (*rwlock != PTHREAD_RWLOCK_INITIALIZER) { return get_posix_rwlock(*rwlock); } @@ -116,7 +116,7 @@ int pthread_rwlock_init(pthread_rwlock_t *rwlock, struct posix_rwlock *rwl; ARG_UNUSED(attr); - *rwlock = POSIX_RWLOCK_INITIALIZER; + *rwlock = PTHREAD_RWLOCK_INITIALIZER; rwl = to_posix_rwlock(rwlock); if (rwl == NULL) {