From b83b83bf516c5f28f7914d20fd90fd253a4d686e Mon Sep 17 00:00:00 2001 From: "chao.an" Date: Wed, 10 Jun 2020 14:08:32 +0800 Subject: [PATCH] pthread/mutex: add PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP support Note: the _NP suffix indicates a non-portable extension to the POSIX specification. Library Functions Manual PTHREAD_MUTEX(3) ... SYNOPSIS ... pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; ... DESCRIPTION PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP (for recursive mutexes). Change-Id: I58320421ee8dc9a90dca4f593b5d3908be3932db Signed-off-by: chao.an --- include/pthread.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/pthread.h b/include/pthread.h index d18ac4f96b..70b188ebbd 100644 --- a/include/pthread.h +++ b/include/pthread.h @@ -344,9 +344,16 @@ typedef struct pthread_mutex_s pthread_mutex_t; # define PTHREAD_MUTEX_INITIALIZER {NULL, SEM_INITIALIZER(1), -1, \ __PTHREAD_MUTEX_DEFAULT_FLAGS, \ PTHREAD_MUTEX_DEFAULT, 0} +# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ + {NULL, SEM_INITIALIZER(1), -1, \ + __PTHREAD_MUTEX_DEFAULT_FLAGS, \ + PTHREAD_MUTEX_RECURSIVE, 0} #elif defined(CONFIG_PTHREAD_MUTEX_TYPES) # define PTHREAD_MUTEX_INITIALIZER {SEM_INITIALIZER(1), -1, \ PTHREAD_MUTEX_DEFAULT, 0} +# define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP \ + {SEM_INITIALIZER(1), -1, \ + PTHREAD_MUTEX_RECURSIVE, 0} #elif !defined(CONFIG_PTHREAD_MUTEX_UNSAFE) # define PTHREAD_MUTEX_INITIALIZER {NULL, SEM_INITIALIZER(1), -1,\ __PTHREAD_MUTEX_DEFAULT_FLAGS}