Module: xenomai-forge
Branch: master
Commit: 7e59ed2b12308f3adffaaf0f46e69f986fad474e
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=7e59ed2b12308f3adffaaf0f46e69f986fad474e

Author: Philippe Gerum <r...@xenomai.org>
Date:   Fri Sep  6 13:18:05 2013 +0200

cobalt/posix/thread: allow extensions to overload sched_yield()

---

 kernel/cobalt/posix/extension.h |    1 +
 kernel/cobalt/posix/thread.c    |    5 +++++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/kernel/cobalt/posix/extension.h b/kernel/cobalt/posix/extension.h
index e73c46f..5c39c01 100644
--- a/kernel/cobalt/posix/extension.h
+++ b/kernel/cobalt/posix/extension.h
@@ -52,6 +52,7 @@ struct cobalt_extension {
                                       struct siginfo __user *u_si,
                                       const struct siginfo *si,
                                       int overrun);
+               int (*sched_yield)(struct cobalt_extref *curref);
        } ops;
 };
 
diff --git a/kernel/cobalt/posix/thread.c b/kernel/cobalt/posix/thread.c
index 68d15f1..92612b7 100644
--- a/kernel/cobalt/posix/thread.c
+++ b/kernel/cobalt/posix/thread.c
@@ -1222,6 +1222,11 @@ int cobalt_sched_max_prio(int policy)
 int cobalt_sched_yield(void)
 {
        struct cobalt_thread *curr = cobalt_current_thread();
+       int ret;
+
+       /* Maybe some extension wants to handle this. */
+       if (cobalt_call_extension(sched_yield, &curr->extref, ret) && ret)
+               return ret > 0 ? 0 : ret;
 
        xnthread_resume(&curr->threadbase, 0);
        if (xnsched_run())


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

Reply via email to