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

Oct 17, 2003 2 Replies

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


Using which method ?

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 SnapGear --- ph: +61 7 3435 2809 | Custom Embedded Solutions fax: +61 7 3891 3630 | and Security Appliances web:

formatting link
--- Free Embedded Linux Distro at
formatting link
---

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 Registered Linux User #112576 (http://counter.li.org/) Slackware - Because I know what I'm doing.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required