This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 5dedc0119f sched/clock: remove unlock logic to avoid relock
5dedc0119f is described below

commit 5dedc0119ffcc0c76ae9711d575a3b3ecfba3d13
Author: chao an <[email protected]>
AuthorDate: Tue Jan 14 00:17:58 2025 +0800

    sched/clock: remove unlock logic to avoid relock
    
    get time spec before protect g_basetime
    
    Signed-off-by: chao an <[email protected]>
---
 sched/clock/clock_initialize.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/sched/clock/clock_initialize.c b/sched/clock/clock_initialize.c
index 020bb2e9b6..ba02b0893a 100644
--- a/sched/clock/clock_initialize.c
+++ b/sched/clock/clock_initialize.c
@@ -163,6 +163,8 @@ static void clock_inittime(FAR const struct timespec *tp)
   struct timespec ts;
   irqstate_t flags;
 
+  clock_systime_timespec(&ts);
+
   flags = spin_lock_irqsave(&g_basetime_lock);
   if (tp)
     {
@@ -173,12 +175,6 @@ static void clock_inittime(FAR const struct timespec *tp)
       clock_basetime(&g_basetime);
     }
 
-  spin_unlock_irqrestore(&g_basetime_lock, flags);
-
-  clock_systime_timespec(&ts);
-
-  flags = spin_lock_irqsave(&g_basetime_lock);
-
   /* Adjust base time to hide initial timer ticks. */
 
   g_basetime.tv_sec  -= ts.tv_sec;

Reply via email to