different fix
This commit is contained in:
parent
d407972b54
commit
f19d56825d
2 changed files with 12 additions and 5 deletions
|
|
@ -285,6 +285,9 @@ threadexitsall(char *msg)
|
||||||
int i, npid, mypid;
|
int i, npid, mypid;
|
||||||
Proc *p;
|
Proc *p;
|
||||||
|
|
||||||
|
if(msg == nil)
|
||||||
|
msg = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only one guy, ever, gets to run this.
|
* Only one guy, ever, gets to run this.
|
||||||
* If two guys do it, inevitably they end up
|
* If two guys do it, inevitably they end up
|
||||||
|
|
@ -296,7 +299,9 @@ threadexitsall(char *msg)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static Lock onelock;
|
static Lock onelock;
|
||||||
lock(&onelock);
|
if(!canlock(&onelock))
|
||||||
|
_exits(threadexitsmsg);
|
||||||
|
threadexitsmsg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg == nil)
|
if(msg == nil)
|
||||||
|
|
|
||||||
|
|
@ -311,6 +311,9 @@ threadexitsall(char *msg)
|
||||||
int i, npid, mypid;
|
int i, npid, mypid;
|
||||||
Proc *p;
|
Proc *p;
|
||||||
|
|
||||||
|
if(msg == nil)
|
||||||
|
msg = "";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Only one guy, ever, gets to run this.
|
* Only one guy, ever, gets to run this.
|
||||||
* If two guys do it, inevitably they end up
|
* If two guys do it, inevitably they end up
|
||||||
|
|
@ -322,14 +325,13 @@ threadexitsall(char *msg)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
static Lock onelock;
|
static Lock onelock;
|
||||||
lock(&onelock);
|
if(!canlock(&onelock))
|
||||||
|
_exits(threadexitsmsg);
|
||||||
|
threadexitsmsg = msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(msg == nil)
|
|
||||||
msg = "";
|
|
||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
lock(&_threadprocslock);
|
lock(&_threadprocslock);
|
||||||
threadexitsmsg = msg;
|
|
||||||
npid = 0;
|
npid = 0;
|
||||||
for(p=_threadprocs; p; p=p->next)
|
for(p=_threadprocs; p; p=p->next)
|
||||||
if(p->osprocid != mypid && p->osprocid >= 1)
|
if(p->osprocid != mypid && p->osprocid >= 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue