From d22aa4b5889179bd057e64f1267b3a96c19f2277 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 12 Feb 2016 08:13:44 -0600 Subject: [PATCH] SIM: In SMP simulation, use pthread_yield(), not up_hostusleep() to reliquish the CPU. --- arch/sim/src/up_idle.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/arch/sim/src/up_idle.c b/arch/sim/src/up_idle.c index 93d850dfe7..2cfd5a5b8c 100644 --- a/arch/sim/src/up_idle.c +++ b/arch/sim/src/up_idle.c @@ -99,8 +99,11 @@ void up_idle(void) if (up_testset(&lock) != SP_UNLOCKED) { - /* We didn't get it... just return and try again later */ + /* We didn't get it... Give other pthreads/CPUs a shot and try again + * later. + */ + pthread_yield(); return; } #endif @@ -189,12 +192,8 @@ void up_idle(void) lock = SP_UNLOCKED; -#if !defined(CONFIG_SIM_WALLTIME) && !defined(CONFIG_SIM_X11FB) /* Give other pthreads/CPUs a shot */ - //pthread_yield(); - up_hostusleep(25*1000); - -#endif + pthread_yield(); #endif }