diff options
author | rsc <devnull@localhost> | 2003-11-23 18:18:00 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2003-11-23 18:18:00 +0000 |
commit | cd7ddc9b5f34da33a2eb0ea761681c2330284e69 (patch) | |
tree | a3f222bf728a1146ee745ae7d1cab1873ac2d019 /src/libthread/exit.c | |
parent | b7e6f4150f0974a3f3b145a23911b7c8a4b9399b (diff) | |
download | plan9port-cd7ddc9b5f34da33a2eb0ea761681c2330284e69.tar.gz plan9port-cd7ddc9b5f34da33a2eb0ea761681c2330284e69.tar.bz2 plan9port-cd7ddc9b5f34da33a2eb0ea761681c2330284e69.zip |
make -> mk
remove clumsy stack hack.
fix exec.
fix nthreads maintenance.
fix threadexitsall not to kill self.
add sun support.
Diffstat (limited to 'src/libthread/exit.c')
-rw-r--r-- | src/libthread/exit.c | 14 |
1 files changed, 10 insertions, 4 deletions
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 <signal.h> +#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<npid; i++) - if(pid[i] != mypid) + for(i=0; i<npid; i++){ + _threaddebug(DBGSCHED, "threadexitsall kill %d", pid[i]); + if(pid[i]==0 || pid[i]==-1) + fprint(2, "bad pid in threadexitsall: %d\n", pid[i]); + else if(pid[i] != mypid) kill(pid[i], SIGTERM); + } /* leave */ exit(0); |