git: 9front

Download patch

ref: f43c26ec78a864ff4063221526f7c6c9d7c633c6
parent: b4b2bbc0be5eaeba35aa2227283a7e7c44268d8e
author: cinap_lenrek <cinap_lenrek@gmx.de>
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();
--