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 2021/12/11 19:11:06 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #4953: sched/semaphore: fix race condition for timed wait

pkarashchenko commented on a change in pull request #4953:
URL: https://github.com/apache/incubator-nuttx/pull/4953#discussion_r767184483



##########
File path: sched/semaphore/sem_tickwait.c
##########
@@ -125,8 +131,21 @@ int nxsem_tickwait(FAR sem_t *sem, clock_t start, uint32_t delay)
 
   wd_cancel(&rtcb->waitdog);
 
-out:
+  if (ret < 0)
+    {
+      goto errout_with_irqdisabled;
+    }
+
+  /* We can now restore interrupts */
+
+  /* Success exits */
+
+success_with_irqdisabled:
+
+  /* Error exits */
 
+errout_with_irqdisabled:

Review comment:
       What is the benefit of this vs single `out:`?

##########
File path: sched/semaphore/sem_clockwait.c
##########
@@ -173,7 +179,11 @@ int nxsem_clockwait(FAR sem_t *sem, clockid_t clockid,
 
   wd_cancel(&rtcb->waitdog);
 
-out:
+  /* We can now restore interrupts and delete the watchdog */
+
+success_with_irqdisabled:
+errout_with_irqdisabled:

Review comment:
       What is the benefit of this vs single `out:`?




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