summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@gnu.org>2008-02-13 10:38:57 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-04-07 23:13:54 +0200
commitef79f627acbdeaf9a225d76aaebe4354eb1909e7 (patch)
treea7499e6fa8ef3f4f177ae62cf36f0fbb16df7ed0 /sysdeps
parent8c337b1f1366ee29dbab6f1ce531957a4674b00c (diff)
libpthread/
2008-02-13 Neal H. Walfield <neal@gnu.org> * sysdeps/l4/hurd/pt-sysdep.c (_pthread_init_routine): Change function signature to take a function pointer and an argument and to not return. (init_routine): Likewise. Pass entry and argument to __pthread_create_internal. Instead of returning, jump to the program counter and switch stacks. libc-parts/ 2008-02-13 Neal H. Walfield <neal@gnu.org> * ia32-cmain.c (cmain): Update user of _pthread_init_routine to reflect API change.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/l4/hurd/pt-sysdep.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sysdeps/l4/hurd/pt-sysdep.c b/sysdeps/l4/hurd/pt-sysdep.c
index a05eb0a5..604f5bf2 100644
--- a/sysdeps/l4/hurd/pt-sysdep.c
+++ b/sysdeps/l4/hurd/pt-sysdep.c
@@ -38,17 +38,18 @@ sigprocmask (int HOW, const sigset_t *restrict SET, sigset_t *restrict OLDSET)
}
/* Forward. */
-static void *init_routine (void);
+static void init_routine (void (*) (void *), void *)
+ __attribute__ ((noreturn));
/* OK, the name of this variable isn't really appropriate, but I don't
want to change it yet. */
-void *(*_pthread_init_routine)(void) = &init_routine;
+void (*_pthread_init_routine)(void (*) (void *), void *) = &init_routine;
/* This function is called from the Hurd-specific startup code. It
should return a new stack pointer for the main thread. The caller
will switch to this new stack before doing anything serious. */
-static void *
-init_routine (void)
+static void
+init_routine (void (*entry) (void *), void *arg)
{
/* Initialize the library. */
__pthread_initialize ();
@@ -57,8 +58,11 @@ init_routine (void)
int err;
/* Create the pthread structure for the main thread (i.e. us). */
- err = __pthread_create_internal (&thread, 0, 0, 0);
+ err = __pthread_create_internal (&thread, 0,
+ (void *(*)(void *)) entry, arg);
assert_perror (err);
- return (void *) thread->mcontext.sp;
+ /* Switch stacks. */
+ l4_start_sp_ip (l4_myself (), thread->mcontext.sp,
+ thread->mcontext.pc);
}