aboutsummaryrefslogtreecommitdiff
path: root/src/libthread/ucontext.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2004-10-22 17:15:30 +0000
committerrsc <devnull@localhost>2004-10-22 17:15:30 +0000
commitba15d71b0cf27ba89d14b547d7ded643e5de6a01 (patch)
treec7147b8d213a434032b5d7a917f295fa985f10d6 /src/libthread/ucontext.c
parent493f3d0fbf548303a8f468ffffca8476607ee2cd (diff)
downloadplan9port-ba15d71b0cf27ba89d14b547d7ded643e5de6a01.tar.gz
plan9port-ba15d71b0cf27ba89d14b547d7ded643e5de6a01.tar.bz2
plan9port-ba15d71b0cf27ba89d14b547d7ded643e5de6a01.zip
debugging, more pthreads crap
Diffstat (limited to 'src/libthread/ucontext.c')
-rw-r--r--src/libthread/ucontext.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/libthread/ucontext.c b/src/libthread/ucontext.c
index b1c5ef53..98e92ccf 100644
--- a/src/libthread/ucontext.c
+++ b/src/libthread/ucontext.c
@@ -1,5 +1,12 @@
#include "threadimpl.h"
+static void
+launcher(void (*f)(void*), void *arg)
+{
+ f(arg);
+ threadexits(nil);
+}
+
void
_threadinitstack(Thread *t, void (*f)(void*), void *arg)
{
@@ -17,7 +24,7 @@ _threadinitstack(Thread *t, void (*f)(void*), void *arg)
/* leave a few words open on both ends */
t->context.uc.uc_stack.ss_sp = t->stk+8;
t->context.uc.uc_stack.ss_size = t->stksize-16;
- makecontext(&t->context.uc, (void(*)())f, 1, arg);
+ makecontext(&t->context.uc, (void(*)())launcher, 2, f, arg);
}
void