summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-12-17 14:09:07 +0100
committerNeal H. Walfield <neal@gnu.org>2008-12-17 14:09:07 +0100
commit9f836a41f30e7156d745dddd83b802356ad1d980 (patch)
treebc3f8cdf2ae8c29f57bbd11c9c7bc5d762555539
parenta858b6d4273835eaf8027275d542c75f210855a3 (diff)
Add function hurd_myself.
2008-12-17 Neal H. Walfield <neal@gnu.org> * thread.h: Include <hurd/exceptions.h>. (struct hurd_utcb): Add field tid. (hurd_myself): New function.
-rw-r--r--hurd/ChangeLog6
-rw-r--r--hurd/thread.h14
2 files changed, 20 insertions, 0 deletions
diff --git a/hurd/ChangeLog b/hurd/ChangeLog
index eeb2a90..5579351 100644
--- a/hurd/ChangeLog
+++ b/hurd/ChangeLog
@@ -1,5 +1,11 @@
2008-12-17 Neal H. Walfield <neal@gnu.org>
+ * thread.h: Include <hurd/exceptions.h>.
+ (struct hurd_utcb): Add field tid.
+ (hurd_myself): New function.
+
+2008-12-17 Neal H. Walfield <neal@gnu.org>
+
* math.h: Move to ../libviengoos/viengoos. Update users.
* bits/ia32/math.h: Remove file.
* headers.m4: Don't link hurd/math.h or hurd/bits/math.h.
diff --git a/hurd/thread.h b/hurd/thread.h
index 4427db3..f65f17f 100644
--- a/hurd/thread.h
+++ b/hurd/thread.h
@@ -93,6 +93,7 @@ struct activation_frame
#include <viengoos/addr-trans.h>
#include <viengoos/cap.h>
#include <viengoos/messenger.h>
+#include <hurd/exceptions.h>
#include <setjmp.h>
/* The user thread control block. */
@@ -125,6 +126,8 @@ struct hurd_utcb
void *alternate_stack;
bool alternate_stack_inuse;
+ vg_thread_id_t tid;
+
#define UTCB_CANARY0 0xCA17A1
#define UTCB_CANARY1 0xDEADB15D
uintptr_t canary0;
@@ -161,6 +164,17 @@ extern void hurd_fault_catcher_register (struct hurd_fault_catcher *catcher);
/* Unregister a fault catch handler. */
extern void hurd_fault_catcher_unregister (struct hurd_fault_catcher *catcher);
+
+static inline vg_thread_id_t
+hurd_myself (void)
+{
+ struct hurd_utcb *utcb = hurd_utcb ();
+
+ if (unlikely (utcb->tid == 0))
+ utcb->tid = vg_myself ();
+
+ return utcb->tid;
+}
#endif /* _HURD_THREAD_H */
#endif /* __need_activation_frame */