Skip to content

Commit

Permalink
posix: re-introduce PTHREAD_RWLOCK_INITIALIZER
Browse files Browse the repository at this point in the history
Rename the POSIX_RWLOCK_INITIALIZER back to PTHREAD_RWLOCK_INITIALIZER.
This was changed in 70e2b02, but PTHREAD_RWLOCK_INITIALIZER is the
standard name used by external libraries.

Change it back to restore compatibility.

(cherry picked from commit c250c33)

Original-Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
GitOrigin-RevId: c250c33
Change-Id: Id15074993e3c3044322ecc3a0ac74c9cfd4d8cb9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5602980
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
  • Loading branch information
fabiobaltieri authored and Chromeos LUCI committed Jun 6, 2024
1 parent af2b727 commit ab34275
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/zephyr/posix/pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/posix/options/rwlock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit ab34275

Please sign in to comment.