From cd7ddc9b5f34da33a2eb0ea761681c2330284e69 Mon Sep 17 00:00:00 2001 From: rsc Date: Sun, 23 Nov 2003 18:18:00 +0000 Subject: make -> mk remove clumsy stack hack. fix exec. fix nthreads maintenance. fix threadexitsall not to kill self. add sun support. --- src/libthread/exit.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src/libthread/exit.c') diff --git a/src/libthread/exit.c b/src/libthread/exit.c index ddf70014..511e5bca 100644 --- a/src/libthread/exit.c +++ b/src/libthread/exit.c @@ -1,5 +1,5 @@ -#include "threadimpl.h" #include +#include "threadimpl.h" char *_threadexitsallstatus; Channel *_threadwaitchan; @@ -13,6 +13,7 @@ threadexits(char *exitstr) p = _threadgetproc(); t = p->thread; t->moribund = 1; + _threaddebug(DBGSCHED, "threadexits %s", exitstr); if(exitstr==nil) exitstr=""; utfecpy(p->exitstr, p->exitstr+ERRMAX, exitstr); @@ -26,6 +27,7 @@ threadexitsall(char *exitstr) int *pid; int i, npid, mypid; + _threaddebug(DBGSCHED, "threadexitsall %s", exitstr); if(exitstr == nil) exitstr = ""; _threadexitsallstatus = exitstr; @@ -34,7 +36,7 @@ threadexitsall(char *exitstr) /* * signal others. - * copying all the pids first avoids other threads + * copying all the pids first avoids other thread's * teardown procedures getting in the way. */ lock(&_threadpq.lock); @@ -46,9 +48,13 @@ threadexitsall(char *exitstr) for(p = _threadpq.head; p; p=p->next) pid[npid++] = p->pid; unlock(&_threadpq.lock); - for(i=0; i