ref: 98f93fe4c16385d1e7fbb074b7782dafdbec8060
parent: fd73e98db9e2dbc16d24ccda47e44ff9c7939811
author: cinap_lenrek <cinap_lenrek@centraldogma>
date: Fri Jun 3 21:04:14 EDT 2011
devaudio: interlock reads too
--- a/sys/src/9/port/devaudio.c
+++ b/sys/src/9/port/devaudio.c
@@ -215,15 +215,15 @@
if(fn == nil)
error(Egreg);
+ qlock(ac);
+ if(waserror()){+ qunlock(ac);
+ nexterror();
+ }
switch((ulong)c->qid.path){case Qaudioctl:
case Qaudiostatus:
case Qvolume:
- qlock(ac);
- if(waserror()){- qunlock(ac);
- nexterror();
- }
/* generate the text on first read */
if(ac->data == nil || off == 0){long l;
@@ -237,11 +237,14 @@
}
/* then serve all requests from buffer */
n = readstr(off, a, n, ac->data);
- qunlock(ac);
- poperror();
- return n;
+ break;
+
+ default:
+ n = fn(adev, a, n, off);
}
- return fn(adev, a, n, off);
+ qunlock(ac);
+ poperror();
+ return n;
}
static long
--
⑨