public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Friesen <cfriesen@nortelnetworks.com>
To: Tom Sanders <developer_linux@yahoo.com>
Cc: redhat-list@redhat.com, linux-kernel@vger.kernel.org,
	redhat-devel-list@redhat.com
Subject: Re: Linux application level timers?
Date: Thu, 23 Jan 2003 11:28:35 -0500	[thread overview]
Message-ID: <3E301833.8030103@nortelnetworks.com> (raw)
In-Reply-To: 20030122221703.42913.qmail@web9806.mail.yahoo.com

Tom Sanders wrote:
> I'm writing an application server which receives
> requests from other applications. For each request
> received, I want to start a timer so that I can fail
> the application request if it could not be completed
> in max specified time.
> 
> Which Linux timer facility can be used for this?

I used setitimer for a similar task.  Since you can only have one timer 
going at any given time, I set up a linked list of timing events, with 
each event's timeout expressed as a delta from the previous event.  This 
way changing the time on the system has no effect on the application. 
The itimer is then set for the first event in the list.  When a timer 
goes off, it optionally re-inserts the event into the list, starts the 
next itimer, and then calls a callback function for the expired event 
with an opaque data pointer as an argument.

Works really well.

Chris



-- 
Chris Friesen                    | MailStop: 043/33/F10
Nortel Networks                  | work: (613) 765-0557
3500 Carling Avenue              | fax:  (613) 765-2986
Nepean, ON K2H 8E9 Canada        | email: cfriesen@nortelnetworks.com


  parent reply	other threads:[~2003-01-23 16:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-22 22:17 Linux application level timers? Tom Sanders
2003-01-22 23:03 ` Steven Dake
2003-01-22 23:35 ` george anzinger
2003-01-23  4:36 ` Gerhard Mack
2003-01-23  8:37 ` Narsimha Reddy CH
2003-01-23  8:51 ` Riku Meskanen
2003-01-23 16:28 ` Chris Friesen [this message]
2003-01-23 17:26   ` DervishD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E301833.8030103@nortelnetworks.com \
    --to=cfriesen@nortelnetworks.com \
    --cc=developer_linux@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=redhat-devel-list@redhat.com \
    --cc=redhat-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox