PERFORCE change 38944 for review
Warner Losh
imp at FreeBSD.org
Tue Sep 30 20:34:16 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=38944
Change 38944 by imp at imp_koguchi on 2003/09/30 20:34:04
cv_wait usually loops, per rwatson.
Affected files ...
.. //depot/doc/strawman-driver.c#6 edit
Differences ...
==== //depot/doc/strawman-driver.c#6 (text+ko) ====
@@ -23,17 +23,24 @@
return EGONE;
if (sc->dead) /* RACE #1, a */
return EGONE;
-...
+ switch (cmd)
+ {
case FOO_GERBIL:
/*
* Wait for a weird GERBIL event in the device and return it
*/
mtx_lock(&sc->mtx);
- cv_wait(&sc->cv, &sc->mtx);
+ sc->sc_gerbil = 0;
+ while (!sc->sc_gerbil) {
+ if (sc->dead) /* Race #1, b */
+ return EGONE;
+ cv_wait(&sc->cv, &sc->mtx);
+ }
mtx_unlock(&sc->mtx);
- if (sc->dead) /* Race #1, b */
- return EGONE;
- ...
+ return (0);
+ default:
+ return (ENOTTY);
+ }
}
static void
More information about the p4-projects
mailing list