Commit 442dd5fb by Nicolas Roche Committed by Arnaud Charlet

adaint.c: Add function __gnat_lwp_self that retrieves the LWP of the current thread.

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
parent cbd8be94
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> 2009-04-15 Ed Schonberg <schonberg@adacore.com>
* sem_ch4.adb: improve error message on exponentiation. * sem_ch4.adb: improve error message on exponentiation.
...@@ -3346,3 +3346,13 @@ __gnat_pthread_setaffinity_np (pthread_t th ATTRIBUTE_UNUSED, ...@@ -3346,3 +3346,13 @@ __gnat_pthread_setaffinity_np (pthread_t th ATTRIBUTE_UNUSED,
} }
#endif #endif
#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
...@@ -464,6 +464,9 @@ package System.OS_Interface is ...@@ -464,6 +464,9 @@ package System.OS_Interface is
function pthread_self return pthread_t; function pthread_self return pthread_t;
pragma Import (C, pthread_self, "pthread_self"); 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 -- -- POSIX.1c Section 17 --
-------------------------- --------------------------
......
...@@ -701,6 +701,7 @@ package body System.Task_Primitives.Operations is ...@@ -701,6 +701,7 @@ package body System.Task_Primitives.Operations is
end if; end if;
Self_ID.Common.LL.Thread := pthread_self; Self_ID.Common.LL.Thread := pthread_self;
Self_ID.Common.LL.LWP := lwp_self;
Specific.Set (Self_ID); Specific.Set (Self_ID);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment