[lkml]   [2003]   [Jan]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Linux application level timers?
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 Friesen | MailStop: 043/33/F10
Nortel Networks | work: (613) 765-0557
3500 Carling Avenue | fax: (613) 765-2986
Nepean, ON K2H 8E9 Canada | email:

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:32    [W:0.048 / U:14.220 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site