about summary refs log tree commit diff
path: root/nptl/sysdeps/sh/tls.h
diff options
context:
space:
mode:
Diffstat (limited to 'nptl/sysdeps/sh/tls.h')
-rw-r--r--nptl/sysdeps/sh/tls.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/nptl/sysdeps/sh/tls.h b/nptl/sysdeps/sh/tls.h
index 1e27b987e0..a6cefa0b31 100644
--- a/nptl/sysdeps/sh/tls.h
+++ b/nptl/sysdeps/sh/tls.h
@@ -117,6 +117,13 @@ typedef struct
      __asm ("stc gbr,%0" : "=r" (__self));				      \
      __self - 1;})
 
+/* Identifier for the current thread.  THREAD_SELF is usable but
+   sometimes more expensive than necessary as in this case.  */
+# define THREAD_ID \
+  ({ struct pthread *__self;						      \
+     __asm ("stc gbr,%0" : "=r" (__self));				      \
+     __self;})
+
 /* Read member of the thread descriptor directly.  */
 # define THREAD_GETMEM(descr, member) (descr->member)