mirror of
https://github.com/apache/nuttx.git
synced 2026-03-23 22:43:57 +08:00
sched/clock: remove unlock logic to avoid relock
get time spec before protect g_basetime Signed-off-by: chao an <anchao.archer@bytedance.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user