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 <anchao@xiaomi.com>
This commit is contained in:
chao.an 2020-06-10 14:08:32 +08:00 committed by Alan Carvalho de Assis
parent a7fdc4ba03
commit b83b83bf51

View File

@ -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}