From ba15d71b0cf27ba89d14b547d7ded643e5de6a01 Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 22 Oct 2004 17:15:30 +0000 Subject: debugging, more pthreads crap --- src/libthread/ucontext.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/libthread/ucontext.c') 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 -- cgit v1.2.3