From 85fd5bf58dfc4e09559837f61bb7c92e20dedd6d Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Mon, 9 Jan 2012 21:18:03 +0100 Subject: [PATCH] eqlock: dont rely on notepending flag when detecting eqlock interruption --- sys/src/9/port/proc.c | 9 +++------ sys/src/9/port/qlock.c | 7 +++---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/sys/src/9/port/proc.c b/sys/src/9/port/proc.c index 6bb60d6b5..118561f3a 100644 --- a/sys/src/9/port/proc.c +++ b/sys/src/9/port/proc.c @@ -892,6 +892,7 @@ int postnote(Proc *p, int dolock, char *n, int flag) { int s, ret; + QLock *q; if(dolock) qlock(&p->debug); @@ -943,13 +944,9 @@ postnote(Proc *p, int dolock, char *n, int flag) switch(p->state){ case Queueing: /* Try and pull out of a eqlock */ - if(p->notepending){ - QLock *q; - - if((q = p->eql) == nil) - break; + if(q = p->eql){ lock(&q->use); - if(p->state == Queueing && p->eql == q && p->notepending){ + if(p->state == Queueing && p->eql == q){ Proc *d, *l; for(l = nil, d = q->head; d; l = d, d = d->qnext){ diff --git a/sys/src/9/port/qlock.c b/sys/src/9/port/qlock.c index ece5488b1..eeb3143f9 100644 --- a/sys/src/9/port/qlock.c +++ b/sys/src/9/port/qlock.c @@ -54,10 +54,9 @@ eqlock(QLock *q) up->state = Queueing; unlock(&q->use); sched(); - if(up->notepending){ - up->notepending = 0; - if(up->eql == q) - qunlock(q); + if(up->eql == 0){ + if(up->notepending) + up->notepending = 0; error(Eintr); } }