You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ma...@apache.org on 2020/07/27 23:37:34 UTC

[incubator-nuttx] 04/04: arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline

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

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

commit 78862c51dceda641edfdc00a57e66d2825f63e67
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jul 25 23:31:54 2020 +0800

    arch/sim: Fix the wrong sleep time calculation in sim_idle_trampoline
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 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 7c78005..2584347 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;