fix missed clunkq wakeup race

front
cinap_lenrek 2012-04-27 18:51:15 +02:00
parent 6bd82b34fd
commit e440d414d5
1 changed files with 1 additions and 2 deletions

View File

@ -500,17 +500,16 @@ closeproc(void*)
poperror(); poperror();
} }
} }
qunlock(&clunkq.q);
lock(&clunkq.l); lock(&clunkq.l);
c = clunkq.head; c = clunkq.head;
if(c == nil){ if(c == nil){
unlock(&clunkq.l); unlock(&clunkq.l);
qunlock(&clunkq.q);
pexit("no work", 1); pexit("no work", 1);
} }
clunkq.head = c->next; clunkq.head = c->next;
clunkq.nclosed++; clunkq.nclosed++;
unlock(&clunkq.l); unlock(&clunkq.l);
qunlock(&clunkq.q);
if(!waserror()){ if(!waserror()){
devtab[c->type]->close(c); devtab[c->type]->close(c);
poperror(); poperror();