Timer in C



Hello, I'm referring to a thread that I started some days ago on
comp.lang.c:
http://groups.google.it/group/comp.lang.c/browse_thread/thread/f99fda3046794678/297684b31a81dcd2?hl=it&lnk=gst&q=timer#297684b31a81dcd2.
I read various documentation on the Internet, but I think neither
ualarm() or setitimer() satisfy me completely. What I need to do, in
fact, is create a series of different timers inside a process, like
timer objects (of course, not true objects, but conceptually it's like
an object), each one referrable, with some kind of reference (a
pointer). Then, under certain conditions, I need to reset one or more
of them (that's why I need some way to refer to every single timer
specificly), to prevent them sending the SIGALARM (any other kind of
signal they might send), because otherwise I line in the console is
written with 'puts("Alarm: The timer x has expired")' or printf(), at
each expiration of each timer.
From what I've read, both ualarm() and setitimer() (the first is
actually based on the second) allows you to manage one single global
timer, the one of the caller process...
So, in my opinion (correct me if I'm wrong, my knownledge of C is
quite limited) the only 2 ways to do this would be:
1 - Create a series of threads, one for each timer I want to create,
and inside each thread call ualarm(), to set the per-thread timer...Or
maybe I'd need to create child processes, instead of threads?
2 - Use a series of timer_create(), without the need to create any per-
timer thread...
Is there a simpler and more lightweight way to do this?
Thanks a lot
.



Relevant Pages

  • Re: Timer in C
    ... timer objects (of course, not true objects, but conceptually it's like ... of them (that's why I need some way to refer to every single timer ... both ualarm() and setitimer() (the first is ...
    (comp.unix.programmer)
  • Re: Making a Service App use less CPU Resources
    ... I used the wrong terminology. ... referring to a visual form, ... referring to the white area named "components" that you have when you start ... As to using the timer. ...
    (borland.public.delphi.language.objectpascal)
  • Re: Clock losing time
    ... In article, mjt ... >> Has anyone else experienced this problem, or is it just a coincidence ... >> that my computer's timer may have malfunctioned at the same time I ... Or are you referring to this article? ...
    (alt.os.linux.suse)
  • Re: Hyperlink to a specific object on a Pp slide
    ... There is no timer. ... As long as the cursor is hovering over the object, ... So I don't know what you are referring to. ... >> Sonia Coleman ...
    (microsoft.public.powerpoint)
  • Re: Timer in C
    ... timer objects (of course, not true objects, but conceptually it's like ... both ualarm() and setitimer() (the first is ... Is this a GUI program? ...
    (comp.unix.programmer)