Re: Best way to implement a resettable timer.
From: Barry Margolin (barmar_at_alum.mit.edu)
Date: 05/27/04
- Next message: Dan Pop: "Re: [OT] Re: writing a dailer in c for a 8051 based system"
- Previous message: silviu: "Re: Advancing from Unix Sysadmin to Programmer"
- In reply to: RJGraham: "Best way to implement a resettable timer."
- Next in thread: Darko M.: "Re: Best way to implement a resettable timer."
- Reply: Darko M.: "Re: Best way to implement a resettable timer."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 ***
- Next message: Dan Pop: "Re: [OT] Re: writing a dailer in c for a 8051 based system"
- Previous message: silviu: "Re: Advancing from Unix Sysadmin to Programmer"
- In reply to: RJGraham: "Best way to implement a resettable timer."
- Next in thread: Darko M.: "Re: Best way to implement a resettable timer."
- Reply: Darko M.: "Re: Best way to implement a resettable timer."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|