Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!seismo!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.unix.wizards Subject: Re: Device driver timeout question ... Message-ID: <8109@mimsy.UUCP> Date: Sun, 23-Aug-87 14:55:38 EDT Article-I.D.: mimsy.8109 Posted: Sun Aug 23 14:55:38 1987 Date-Received: Mon, 24-Aug-87 00:00:28 EDT References: <570@obiwan.UUCP> <533@micas.UUCP> <474@mtxinu.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 51 In article <474@mtxinu.UUCP> ed@mtxinu.UUCP (Ed Gould) writes: >untimeout() has been part of BSD-derived systems since at least 4.2BSD; >I don't remember for sure if it was in 4.1, but I imagine that it was. As I recall, we had to install untimeout() when we installed CMU IPC. Anyway, as to watchdog timers, untimeout() seems unnecessary: fooopen(dev, flag) dev_t dev; int flag; { ... s = spl5(); /* start the watchdog timer, if necessary */ foostate = FOO_OPEN; if (foowstart == 0) { timeout(foowatch, (caddr_t)0, hz); foowstart++; } splx(s); ... } fooclose(dev) dev_t dev; { foostate = FOO_CLOSED; ... } /* check on the foo once a second */ foowatch() { /* stop timing if we have closed down the foo */ if (foostate == FOO_CLOSED) { foowstart = 0; /* and remember to restart */ return; } timeout(foowatch, (caddr_t)0, hz); ... } Or, as I do in my UDA50 driver, let the timer run always. (Someday I may move the timer to uba.c.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7690) Domain: chris@mimsy.umd.edu Path: seismo!mimsy!chris