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.

Signed-off-by: Fabio Baltieri <[email protected]>
  • Loading branch information
fabiobaltieri committed Jun 5, 2024
1 parent d3081e2 commit 32ffe77
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 32ffe77

Please sign in to comment.