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


The following commit(s) were added to refs/heads/master by this push:
     new 2a2dd35  arch/sim: Fix warning: implicit declaration of function 
‘pthread_yield’
2a2dd35 is described below

commit 2a2dd3533944fcfd5c144541a6d2ee77ec8e8dc8
Author: Xiang Xiao <xiaoxi...@xiaomi.com>
AuthorDate: Fri Jul 31 22:09:28 2020 +0800

    arch/sim: Fix warning: implicit declaration of function ‘pthread_yield’
    
    
https://stackoverflow.com/questions/32174861/why-implicit-declaration-of-pthread-yield-with-lpthread-while-all-ok-with-pthr
    
    Signed-off-by: Xiang Xiao <xiaoxi...@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 2584347..6a2ac32 100644
--- a/arch/sim/src/sim/up_simsmp.c
+++ b/arch/sim/src/sim/up_simsmp.c
@@ -41,6 +41,7 @@
 #include <pthread.h>
 #include <semaphore.h>
 #include <signal.h>
+#include <sched.h>
 #include <errno.h>
 
 /****************************************************************************
@@ -183,7 +184,7 @@ static void *sim_idle_trampoline(void *arg)
 #else
       /* Give other pthreads/CPUs a shot */
 
-      pthread_yield();
+      sched_yield();
 #endif
     }
 
@@ -418,7 +419,7 @@ int up_cpu_pause(int cpu)
 
   while (g_cpu_paused[cpu] != 0)
     {
-      pthread_yield();
+      sched_yield();
     }
 
   return 0;

Reply via email to