jlaitine commented on code in PR #16030:
URL: https://github.com/apache/nuttx/pull/16030#discussion_r2008083224


##########
include/nuttx/semaphore.h:
##########
@@ -59,6 +59,54 @@
      {(c), (f), SEM_WAITLIST_INITIALIZER}
 #endif /* CONFIG_PRIORITY_INHERITANCE */
 
+/* Fast mutex lock/unlock path */
+
+#ifndef CONFIG_LIBC_ARCH_ATOMIC
+
+#  if defined(CONFIG_PRIORITY_PROTECT) || defined(CONFIG_PRIORITY_INHERITANCE)
+#    define NXSEM_IS_FASTMUTEX(sem)                                       \
+      (((sem)->flags & (SEM_TYPE_MUTEX | SEM_PRIO_MASK)) ==               \
+       (SEM_TYPE_MUTEX | SEM_PRIO_NONE))
+#  else
+#    define NXSEM_IS_FASTMUTEX(sem) ((sem)->flags & SEM_TYPE_MUTEX)
+#  endif
+
+/* Try wait; sets ret to OK or -EAGAIN when success,
+ * -EPERM when fast locking can't be performed
+ */
+
+#  define NXSEM_TRYWAIT_FAST(sem, ret)                                    \

Review Comment:
   Which standard we need to comply to nowdays in common code? Inline is c99 / 
gnu90, not c89 or ansi. This macro is compatible with all standards and 
compilers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to