eqlock: dont rely on notepending flag when detecting eqlock interruption

This commit is contained in:
cinap_lenrek 2012-01-09 21:18:03 +01:00
parent 7cd268a783
commit 85fd5bf58d
2 changed files with 6 additions and 10 deletions

View file

@ -892,6 +892,7 @@ int
postnote(Proc *p, int dolock, char *n, int flag) postnote(Proc *p, int dolock, char *n, int flag)
{ {
int s, ret; int s, ret;
QLock *q;
if(dolock) if(dolock)
qlock(&p->debug); qlock(&p->debug);
@ -943,13 +944,9 @@ postnote(Proc *p, int dolock, char *n, int flag)
switch(p->state){ switch(p->state){
case Queueing: case Queueing:
/* Try and pull out of a eqlock */ /* Try and pull out of a eqlock */
if(p->notepending){ if(q = p->eql){
QLock *q;
if((q = p->eql) == nil)
break;
lock(&q->use); lock(&q->use);
if(p->state == Queueing && p->eql == q && p->notepending){ if(p->state == Queueing && p->eql == q){
Proc *d, *l; Proc *d, *l;
for(l = nil, d = q->head; d; l = d, d = d->qnext){ for(l = nil, d = q->head; d; l = d, d = d->qnext){

View file

@ -54,10 +54,9 @@ eqlock(QLock *q)
up->state = Queueing; up->state = Queueing;
unlock(&q->use); unlock(&q->use);
sched(); sched();
if(up->notepending){ if(up->eql == 0){
up->notepending = 0; if(up->notepending)
if(up->eql == q) up->notepending = 0;
qunlock(q);
error(Eintr); error(Eintr);
} }
} }