Is there any similar API like Window's SetTimer()?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi!

In Windows, there is a API settimer() which takes callback function as
input argument. When the timer expires, the callback will be called.
But in Linux, I just found that OS would send an event to the process
when the timer expires.

Is there any similar API like Window's SetTimer() in Linux?

BRs, // Charlie

Re: Is there any similar API like Window's SetTimer()?
Quoted text here. Click to load it
Using which method ?

Quoted text here. Click to load it
You should be able to achieve the same using some combination of:
sigaction
signal
setitimer
or add_timer del_timer in the kernel.


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Damion de Soto - Software Engineer  email:     snipped-for-privacy@snapgear.com
We've slightly trimmed the long signature. Click to see the full one.
Re: Is there any similar API like Window's SetTimer()?
Quoted text here. Click to load it

Take a look at the setitimer(2), signal(2) and signal(7) manpages

You're looking for signal SIGALARM sent by setitimer(2) to the callback
specified by the signal(2) syscall.

--
Lew Pitcher

Master Codewright and JOAT-in-training
We've slightly trimmed the long signature. Click to see the full one.

Site Timeline