From 78862c51dceda641edfdc00a57e66d2825f63e67 Mon Sep 17 00:00:00 2001 From: Xiang Xiao Date: Sat, 25 Jul 2020 23:31:54 +0800 Subject: [PATCH] arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline Signed-off-by: Xiang Xiao --- arch/sim/src/sim/up_simsmp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/sim/src/sim/up_simsmp.c b/arch/sim/src/sim/up_simsmp.c index 7c780052d0..2584347a9e 100644 --- a/arch/sim/src/sim/up_simsmp.c +++ b/arch/sim/src/sim/up_simsmp.c @@ -135,6 +135,9 @@ void sched_note_cpu_resume(struct tcb_s *tcb, int cpu); static void *sim_idle_trampoline(void *arg) { struct sim_cpuinfo_s *cpuinfo = (struct sim_cpuinfo_s *)arg; +#ifdef CONFIG_SIM_WALLTIME + uint64_t now = 0; +#endif sigset_t set; int ret; @@ -173,8 +176,6 @@ static void *sim_idle_trampoline(void *arg) for (; ; ) { #ifdef CONFIG_SIM_WALLTIME - uint64_t now = 0; - /* Wait a bit so that the timing is close to the correct rate. */ now += 1000 * CONFIG_USEC_PER_TICK;