devdraw: use QLock to serialize sleep on refresh to prevent double sleep

front
cinap_lenrek 2012-02-20 10:49:14 +01:00
parent e992808e49
commit 5b07f6238b
1 changed files with 9 additions and 1 deletions

View File

@ -73,6 +73,7 @@ struct Client
CScreen* cscreen; CScreen* cscreen;
Refresh* refresh; Refresh* refresh;
Rendez refrend; Rendez refrend;
QLock refq;
uchar* readdata; uchar* readdata;
int nreaddata; int nreaddata;
int busy; int busy;
@ -1227,11 +1228,18 @@ drawread(Chan *c, void *a, long n, vlong off)
break; break;
dunlock(); dunlock();
if(waserror()){ if(waserror()){
dlock(); /* restore lock for waserror() above */ dlock();
nexterror();
}
eqlock(&cl->refq);
if(waserror()){
qunlock(&cl->refq);
nexterror(); nexterror();
} }
sleep(&cl->refrend, drawrefactive, cl); sleep(&cl->refrend, drawrefactive, cl);
poperror(); poperror();
qunlock(&cl->refq);
poperror();
dlock(); dlock();
} }
p = a; p = a;