about summary refs log tree commit diff
path: root/htl/pt-self.c
diff options
context:
space:
mode:
Diffstat (limited to 'htl/pt-self.c')
-rw-r--r--htl/pt-self.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/htl/pt-self.c b/htl/pt-self.c
index 6fd3c98b82..e05ec69bf5 100644
--- a/htl/pt-self.c
+++ b/htl/pt-self.c
@@ -24,7 +24,13 @@
 pthread_t
 __pthread_self (void)
 {
-  struct __pthread *self = _pthread_self ();
+  struct __pthread *self;
+
+  if (___pthread_self == NULL)
+    /* We are not initialized yet, we are the first thread.  */
+    return 1;
+
+  self = _pthread_self ();
   assert (self != NULL);
 
   return self->thread;