Date: Tue, 30 Sep 2003 20:34:14 -0700 (PDT) From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 38944 for review Message-ID: <200310010334.h913YEnh051107@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=38944 Change 38944 by imp@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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310010334.h913YEnh051107>