Skip to content

Commit 9829870

Browse files
committed
Enable mutex fast path for sem_wait and nxsem_wait also when priority inheritance is enabled
This enables the mutex fast path for nxsem_wait, nxsem_trywait and nxsem_post also when the priority inheritance is enabled.
1 parent b496126 commit 9829870

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

libs/libc/semaphore/sem_post.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ int nxsem_post(FAR sem_t *sem)
128128

129129
#ifndef CONFIG_LIBC_ARCH_ATOMIC
130130

131-
if ((sem->flags & SEM_TYPE_MUTEX)
132-
# if defined(CONFIG_PRIORITY_PROTECT) || defined(CONFIG_PRIORITY_INHERITANCE)
133-
&& (sem->flags & SEM_PRIO_MASK) == SEM_PRIO_NONE
131+
if (NXSEM_IS_MUTEX(sem)
132+
# if defined(CONFIG_PRIORITY_PROTECT)
133+
&& (sem->flags & SEM_PRIO_MASK) != SEM_PRIO_PROTECT
134134
# endif
135135
)
136136
{

libs/libc/semaphore/sem_trywait.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,9 @@ int nxsem_trywait(FAR sem_t *sem)
122122

123123
#ifndef CONFIG_LIBC_ARCH_ATOMIC
124124

125-
if ((sem->flags & SEM_TYPE_MUTEX)
126-
#if defined(CONFIG_PRIORITY_PROTECT) || defined(CONFIG_PRIORITY_INHERITANCE)
127-
&& (sem->flags & SEM_PRIO_MASK) == SEM_PRIO_NONE
125+
if (NXSEM_IS_MUTEX(sem)
126+
#if defined(CONFIG_PRIORITY_PROTECT)
127+
&& (sem->flags & SEM_PRIO_MASK) != SEM_PRIO_PROTECT
128128
#endif
129129
)
130130
{

libs/libc/semaphore/sem_wait.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ int nxsem_wait(FAR sem_t *sem)
150150

151151
#ifndef CONFIG_LIBC_ARCH_ATOMIC
152152

153-
if ((sem->flags & SEM_TYPE_MUTEX)
154-
# if defined(CONFIG_PRIORITY_PROTECT) || defined(CONFIG_PRIORITY_INHERITANCE)
155-
&& (sem->flags & SEM_PRIO_MASK) == SEM_PRIO_NONE
153+
if (NXSEM_IS_MUTEX(sem)
154+
# if defined(CONFIG_PRIORITY_PROTECT)
155+
&& (sem->flags & SEM_PRIO_MASK) != SEM_PRIO_PROTECT
156156
# endif
157157
)
158158
{

0 commit comments

Comments
 (0)