Best way to implement a resettable timer.

From: RJGraham (null_at_null.com)
Date: 05/27/04


Date: Thu, 27 May 2004 08:36:49 -0700

What's the best way to to implement a resettable timer, kind of like a
watchdog timer that can be reset.

I want to be able to start a timer to wait on an event, and either
timeout, or reset the timer to wait on the next event. The idea here is
to detect timeouts in my application.

select() would seem to be the obvious choice, but I need a file
descriptor and my timeouts are not necessarily tied to file i/o (or
other I/O).

Is it acceptable to open a file descriptor on '/dev/null' and FD_SET it
to break out of a select() wait for my timer?

Otherwise, how can I create a fd to use with select that is not tied to
file I/O, that I can set/reset ?

-Randy



Relevant Pages

  • Re: Best way to implement a resettable timer.
    ... > watchdog timer that can be reset. ... or reset the timer to wait on the next event. ... > is to detect timeouts in my application. ... Create a pipe() and selecton the reading end. ...
    (comp.unix.programmer)
  • Power manager problem Hive
    ... Before going to autosuspend I always get a reset of the ... 'SystemActivity' timer. ... FATFS!ReadStreamBuffer: begin findbuffer ... begin entercritsec ...
    (microsoft.public.windowsce.platbuilder)
  • RE: Power manager problem Hive
    ... > Before going to autosuspend I always get a reset of the ... > 'SystemActivity' timer. ... > FATFS!ReadStreamBuffer: begin findbuffer ... > begin entercritsec ...
    (microsoft.public.windowsce.platbuilder)
  • Re: synthesizing rightof or succ
    ... process (clock, reset) ... variable timer, next_timer: unsigned; ... state <= t31; ... DOULOS - Developing Design Know-how ...
    (comp.lang.vhdl)
  • Re: [patch 00/43] ktimer reworked
    ... For instance, when Kyle came out with his one-sentence description of timers versus timeouts, I thought he had them backwards. ... A timer (like a kitchen timer telling you the cookies are done) is optimized to be added and sit around until it expires. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)