You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/01/07 03:01:28 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5180: pthread: restore pthread mutex default protocol POSIX compatibility

xiaoxiang781216 commented on a change in pull request #5180:
URL: https://github.com/apache/incubator-nuttx/pull/5180#discussion_r779998603



##########
File path: libs/libc/pthread/pthread_mutexattr_setprotocol.c
##########
@@ -54,21 +54,24 @@ int pthread_mutexattr_setprotocol(FAR pthread_mutexattr_t *attr,
   linfo("attr=0x%p protocol=%d\n", attr, protocol);
   DEBUGASSERT(attr != NULL);
 
-#ifdef CONFIG_PRIORITY_INHERITANCE
   if (protocol >= PTHREAD_PRIO_NONE && protocol <= PTHREAD_PRIO_PROTECT)

Review comment:
       ·
   can simplify to:
   ···
   switch (protocol)
   {
   case PTHREAD_PRIO_NONE:
   #ifdef CONFIG_PRIORITY_INHERITANCE
   case PTHREAD_PRIO_INHERIT:
   #endif
       attr->proto = protocol;
       return OK;
   
   case PTHREAD_PRIO_PROTECT:
      return ENOTSUP;
   
   default:
     return EINVAL;
   }
   ```
   }




-- 
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-unsubscribe@nuttx.apache.org

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