tsignal handling, add prototype for pthreadinit - plan9port - [fork] Plan 9 from user space (HTM) git clone git://src.adamsgaard.dk/plan9port (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- (DIR) commit e1dc7e4511d4644060d4904dcae50808d966fff7 (DIR) parent 43db87f1fcb51065ef50beae9da8b6310ccf1cae (HTM) Author: rsc <devnull@localhost> Date: Mon, 27 Dec 2004 00:13:48 +0000 signal handling, add prototype for pthreadinit Diffstat: M src/libthread/pthread.c | 2 +- M src/libthread/thread.c | 12 ++++++++++-- M src/libthread/threadimpl.h | 9 ++++++++- 3 files changed, 19 insertions(+), 4 deletions(-) --- (DIR) diff --git a/src/libthread/pthread.c b/src/libthread/pthread.c t@@ -101,7 +101,7 @@ _threadsetproc(Proc *p) } void -pthreadinit(void) +_pthreadinit(void) { pthread_key_create(&prockey, 0); } (DIR) diff --git a/src/libthread/thread.c b/src/libthread/thread.c t@@ -190,7 +190,7 @@ scheduler(void *v) p = v; setproc(p); - print("s %p %d\n", p, gettid()); + // print("s %p %d\n", p, gettid()); p->tid = pthread_self(); pthread_detach(p->tid); lock(&p->lock); t@@ -503,6 +503,13 @@ threadmainstart(void *v) threadmain(threadargc, threadargv); } +extern Jmp *(*_notejmpbuf)(void); +static Jmp* +threadnotejmp(void) +{ + return &proc()->sigjmp; +} + int main(int argc, char **argv) { t@@ -524,8 +531,9 @@ main(int argc, char **argv) _wunlock = threadwunlock; _rsleep = threadrsleep; _rwakeup = threadrwakeup; + _notejmpbuf = threadnotejmp; - pthreadinit(); + _pthreadinit(); p = procalloc(); if(mainstacksize == 0) mainstacksize = 65536; (DIR) diff --git a/src/libthread/threadimpl.h b/src/libthread/threadimpl.h t@@ -4,6 +4,12 @@ typedef struct Context Context; typedef struct Proc Proc; typedef struct _Procrendez _Procrendez; +typedef struct Jmp Jmp; +struct Jmp +{ + p9jmp_buf b; +}; + enum { STACK = 8192 t@@ -54,6 +60,7 @@ struct Proc _Procrendez runrend; Context schedcontext; void *udata; + Jmp sigjmp; }; extern Proc *xxx; t@@ -67,4 +74,4 @@ extern Proc *_threadproc(void); extern void _threadsetproc(Proc*); extern int _threadlock(Lock*, int, ulong); extern void _threadunlock(Lock*, ulong); - +extern void _pthreadinit(void);