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/04/07 17:49:15 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #5931: fix: pthread_rwlock_timedwrlock.

xiaoxiang781216 commented on code in PR #5931:
URL: https://github.com/apache/incubator-nuttx/pull/5931#discussion_r845413881


##########
libs/libc/pthread/pthread_rwlock_rdlock.c:
##########
@@ -118,6 +118,11 @@ int pthread_rwlock_clockrdlock(FAR pthread_rwlock_t *rw_lock,
         {
           err = pthread_cond_clockwait(&rw_lock->cv, &rw_lock->lock,
                                        clockid, ts);
+
+          if (err == EINTR)

Review Comment:
   why not return EINTR?



##########
sched/signal/sig_dispatch.c:
##########
@@ -435,7 +446,18 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
       if (stcb->task_state == TSTATE_WAIT_MQNOTEMPTY ||
           stcb->task_state == TSTATE_WAIT_MQNOTFULL)
         {
-          nxmq_wait_irq(stcb, EINTR);
+#ifndef CONFIG_DISABLE_PTHREAD

Review Comment:
   ditto



##########
sched/signal/sig_dispatch.c:
##########
@@ -424,7 +424,18 @@ int nxsig_tcbdispatch(FAR struct tcb_s *stcb, siginfo_t *info)
 
       if (stcb->task_state == TSTATE_WAIT_SEM)
         {
+#ifndef CONFIG_DISABLE_PTHREAD

Review Comment:
   why need check CONFIG_DISABLE_PTHREAD?



##########
libs/libc/pthread/pthread_rwlock_wrlock.c:
##########
@@ -113,6 +113,12 @@ int pthread_rwlock_clockwrlock(FAR pthread_rwlock_t *rw_lock,
         {
           err = pthread_cond_clockwait(&rw_lock->cv, &rw_lock->lock,
                                        clockid, ts);
+
+          if (err == EINTR)

Review Comment:
   ditto



##########
sched/semaphore/sem_wait.c:
##########
@@ -63,8 +63,9 @@
  *   returned on success.  A negated errno value is returned on failure.
  *   Possible returned errors:
  *
- *   - EINVAL:  Invalid attempt to get the semaphore
- *   - EINTR:   The wait was interrupted by the receipt of a signal.
+ *   - EINVAL:   Invalid attempt to get the semaphore
+ *   - EINTR:    The wait was interrupted by the receipt of a signal.
+ *   - ETIMEOUT: The wait was interrupted by the receipt of a timeout signal.

Review Comment:
   But why not issue set the error code correctly in the first place?



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