Rafi Cohen wrote:
> Hi, I need some advice implementing timers in a multithread aplication
> on linux (suse 9.3, kernel 2.6.11).
> The application is written in C.
> At first, I chose to use alarm() with a handler for SIGALRM, but after
> some tests I concluded tht it's not wise to use this in a multithread
> application, since it seems that each call to alarm() affects or even
> cancels the previous one, even though the previous call was in another
> thread.
> Do I miss here something? may this still be used in a multithread
> application?
> Yes, I know about getitimer and setitimer, but I do not understand how
> to adjust the timer, for example if I want a timer of 20 seconds.
> If this is the solution you suggest, please provide an example that
> shows how to use those functions.
> Generally, any advise concerning this issue will be most appreciated.
> Thanks, Rafi.
I've read the entire thread, and it has some very correct advice from
Gilad and others.

However, before you start implementing away, I suggest you take a look
at libevent (http://freshmeat.net/projects/libevent/). I believe it does
all you're looking for (and quite a bit more), and may save you a
considerable amount of time.

Shachar

-- 
Shachar Shemesh
Lingnu Open Source Consulting ltd.
Have you backed up today's work? http://www.lingnu.com/backup.html


=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to