Module: xenomai-forge
Branch: next
Commit: 3066ea77b883dad0c632995f2fda79cced07429c
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=3066ea77b883dad0c632995f2fda79cced07429c

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Jun  6 15:24:02 2014 +0200

lib/cobalt: do not route relaxed threads to standard sched_yield()

Doing so brings no upside, and uselessly delays switch back to primary
mode. Conversely, this change makes sched_yield() act as a conforming
call for Xenomai threads which may be helpful in some cases.

---

 lib/cobalt/thread.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/lib/cobalt/thread.c b/lib/cobalt/thread.c
index e8c8961..ec23bfd 100644
--- a/lib/cobalt/thread.c
+++ b/lib/cobalt/thread.c
@@ -163,21 +163,10 @@ int pthread_getschedparam_ex(pthread_t thread,
 
 COBALT_IMPL(int, sched_yield, (void))
 {
-       unsigned long status;
-       int ret;
-
-       status = cobalt_get_current_mode();
-       if (status & XNRELAX)
-               goto libc_yield;
-
-       ret = -XENOMAI_SKINCALL0(__cobalt_muxid, sc_cobalt_sched_yield);
-       if (ret == EPERM)
-               goto libc_yield;
-
-       return ret;
+       if (cobalt_get_current() == XN_NO_HANDLE)
+               return __STD(sched_yield());
 
-libc_yield:
-       return __STD(sched_yield());
+       return -XENOMAI_SKINCALL0(__cobalt_muxid, sc_cobalt_sched_yield);
 }
 
 COBALT_IMPL(int, sched_get_priority_min, (int policy))


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to