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/07/21 18:55:29 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a diff in pull request #6679: sched_critmonitor: remove check zero in sched_critmonitor

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


##########
sched/sched/sched_critmonitor.c:
##########
@@ -138,31 +138,18 @@ void nxsched_critmon_preemption(FAR struct tcb_s *tcb, bool state)
 
   if (state)
     {
-      DEBUGASSERT(tcb->premp_start == 0);
-
       /* Disabling.. Save the thread start time */
 
-      tcb->premp_start = up_perf_gettime();
-
-      /* Zero means that the timer is not ready */
-
-      if (tcb->premp_start != 0 && g_premp_start[cpu] == 0)
-        {
-          /* Save the global start time */
-
-          g_premp_start[cpu] = tcb->premp_start;
-        }
+      tcb->premp_start   = up_perf_gettime();
+      g_premp_start[cpu] = up_perf_gettime();

Review Comment:
   ```suggestion
         g_premp_start[cpu] = tcb->premp_start;
   ```



##########
sched/sched/sched_critmonitor.c:
##########
@@ -206,28 +188,16 @@ void nxsched_critmon_csection(FAR struct tcb_s *tcb, bool state)
     {
       /* Entering... Save the start time. */
 
-      DEBUGASSERT(tcb->crit_start == 0);
-      tcb->crit_start = up_perf_gettime();
-
-      /* Zero means that the timer is not ready */
-
-      if (tcb->crit_start != 0 && g_crit_start[cpu] == 0)
-        {
-          /* Set the global start time */
-
-          g_crit_start[cpu] = tcb->crit_start;
-        }
+      tcb->crit_start   = up_perf_gettime();
+      g_crit_start[cpu] = up_perf_gettime();

Review Comment:
   ```suggestion
         g_crit_start[cpu] = tcb->crit_start;
   ```



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