Module: xenomai-jki
Branch: for-upstream
Commit: 9750df0abf7c8966ad5de17b43a152bcb75b021b
URL:    
http://git.xenomai.org/?p=xenomai-jki.git;a=commit;h=9750df0abf7c8966ad5de17b43a152bcb75b021b

Author: Jan Kiszka <jan.kis...@siemens.com>
Date:   Thu Mar 11 10:59:30 2010 +0100

common: Introduce xeno_get_current_fast

Introduce xeno_get_current_fast as syscall-free alternative to
xeno_get_current. The limitation of this variant is that it does not
reliably detect Xenomai threads under !HAVE___THREAD when used from TSD
destructors.

Signed-off-by: Jan Kiszka <jan.kis...@siemens.com>

---

 include/asm-generic/bits/current.h |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/include/asm-generic/bits/current.h 
b/include/asm-generic/bits/current.h
index b9ac680..8a213d2 100644
--- a/include/asm-generic/bits/current.h
+++ b/include/asm-generic/bits/current.h
@@ -19,6 +19,8 @@ static inline xnhandle_t xeno_get_current(void)
        return xeno_current;
 }
 
+#define xeno_get_current_fast() xeno_get_current()
+
 static inline unsigned long xeno_get_current_mode(void)
 {
        unsigned long mode = xeno_current_mode;
@@ -36,6 +38,14 @@ static inline xnhandle_t xeno_get_current(void)
        return (xnhandle_t)val ?: xeno_slow_get_current();
 }
 
+/* syscall-free, but unreliable in TSD destructor context */
+static inline xnhandle_t xeno_get_current_fast(void)
+{
+       void *val = pthread_getspecific(xeno_current_key);
+
+       return (xnhandle_t)val ?: XN_NO_HANDLE;
+}
+
 static inline unsigned long xeno_get_current_mode(void)
 {
        unsigned long *mode = pthread_getspecific(xeno_current_mode_key);


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to