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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Sep 25 15:18:15 2014 +0200

lib/cobalt: add cobalt_thread_relax() to the internal API

---

 include/cobalt/sys/cobalt.h |    2 ++
 lib/cobalt/internal.c       |    8 ++++++++
 2 files changed, 10 insertions(+)

diff --git a/include/cobalt/sys/cobalt.h b/include/cobalt/sys/cobalt.h
index f64ae4e..6a0aa3c 100644
--- a/include/cobalt/sys/cobalt.h
+++ b/include/cobalt/sys/cobalt.h
@@ -71,6 +71,8 @@ void __cobalt_commit_memory(void *p, size_t len);
 
 void cobalt_thread_harden(void);
 
+void cobalt_thread_relax(void);
+
 int cobalt_thread_join(pthread_t thread);
 
 pid_t cobalt_thread_pid(pthread_t thread);
diff --git a/lib/cobalt/internal.c b/lib/cobalt/internal.c
index 89edc0a..aa6292d 100644
--- a/lib/cobalt/internal.c
+++ b/lib/cobalt/internal.c
@@ -52,6 +52,14 @@ void cobalt_thread_harden(void)
                XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_PRIMARY);
 }
 
+void cobalt_thread_relax(void)
+{
+       unsigned long status = cobalt_get_current_mode();
+
+       if ((status & XNRELAX) == 0)
+               XENOMAI_SYSCALL1(sc_cobalt_migrate, COBALT_SECONDARY);
+}
+
 int cobalt_thread_stat(pid_t pid, struct cobalt_threadstat *stat)
 {
        return XENOMAI_SYSCALL2(sc_cobalt_thread_getstat, pid, stat);


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

Reply via email to