Re: Best way to implement a resettable timer.

From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 05/27/04


Date: Thu, 27 May 2004 12:27:28 -0400

In article <xKudnSWVeor1livdRVn_vQ@giganews.com>,
 RJGraham <null@null.com> wrote:

> 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.

Use alarm() to schedule a SIGALRM signal. Since there's only one such
timer per process, every time you reschedule it the previous one will be
reset.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


Relevant Pages

  • 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: Changing the Resuming state while password screen is shown
    ... To keep device awake enter unattended mode and reset the idle ... reset the idle timer or/and enter the unattended mode. ...
    (microsoft.public.pocketpc.developer)
  • Re: Help designing an reset hourly timer... 555??
    ... > I have a number of network unreliable network appliances scattered out ... The hourly pulse should be 'astable', i.e. i'd like it to occur ... > the reset switch. ... Use one timer as a clock ...
    (sci.electronics.design)