2009-04-15 Nicolas Roche <roche@adacore.com>
* adaint.c: Add function __gnat_lwp_self that retrieves the LWP of the
current thread.
* s-osinte-linux.ads: Import the __gnat_lwp_self function as lwp_self
* s-taprop-linux.adb (Enter_Task): Store the LWP in the TCB
From-SVN: r146097
+2009-04-15 Nicolas Roche <roche@adacore.com>
+
+ * adaint.c: Add function __gnat_lwp_self that retrieves the LWP of the
+ current thread.
+
+ * s-osinte-linux.ads: Import the __gnat_lwp_self function as lwp_self
+
+ * s-taprop-linux.adb (Enter_Task): Store the LWP in the TCB
+
2009-04-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb: improve error message on exponentiation.
}
#endif
#endif
+
+#if defined (linux)
+/* There is no function in the glibc to retrieve the LWP of the current
+ thread. We need to do a system call in order to retrieve this
+ information. */
+#include <sys/syscall.h>
+void *__gnat_lwp_self (void) {
+ return (void *) syscall (__NR_gettid);
+}
+#endif
function pthread_self return pthread_t;
pragma Import (C, pthread_self, "pthread_self");
+ function lwp_self return System.Address;
+ pragma Import (C, lwp_self, "__gnat_lwp_self");
+
--------------------------
-- POSIX.1c Section 17 --
--------------------------
end if;
Self_ID.Common.LL.Thread := pthread_self;
+ Self_ID.Common.LL.LWP := lwp_self;
Specific.Set (Self_ID);