shithub: riscv

Download patch

ref: 85fd5bf58dfc4e09559837f61bb7c92e20dedd6d
parent: 7cd268a78340f4a0bf92415dd5c87abb59830493
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Mon Jan 9 16:18:03 EST 2012

eqlock: dont rely on notepending flag when detecting eqlock interruption

--- a/sys/src/9/port/proc.c
+++ b/sys/src/9/port/proc.c
@@ -892,6 +892,7 @@
 postnote(Proc *p, int dolock, char *n, int flag)
 {
 	int s, ret;
+	QLock *q;
 
 	if(dolock)
 		qlock(&p->debug);
@@ -943,13 +944,9 @@
 	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){
--- a/sys/src/9/port/qlock.c
+++ b/sys/src/9/port/qlock.c
@@ -54,10 +54,9 @@
 	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);
 	}
 }