shithub: riscv

Download patch

ref: e440d414d57af87e40fff560b58077443af91696
parent: 6bd82b34fd6ff8955ff372c1e84ec94e80ddf98a
author: cinap_lenrek <[email protected]>
date: Fri Apr 27 14:51:15 EDT 2012

fix missed clunkq wakeup race

--- a/sys/src/9/port/chan.c
+++ b/sys/src/9/port/chan.c
@@ -500,17 +500,16 @@
 				poperror();
 			}
 		}
+		qunlock(&clunkq.q);
 		lock(&clunkq.l);
 		c = clunkq.head;
 		if(c == nil){
 			unlock(&clunkq.l);
-			qunlock(&clunkq.q);
 			pexit("no work", 1);
 		}
 		clunkq.head = c->next;
 		clunkq.nclosed++;
 		unlock(&clunkq.l);
-		qunlock(&clunkq.q);
 		if(!waserror()){
 			devtab[c->type]->close(c);
 			poperror();