C Timer Callback C Timer Callback unix unix

C Timer Callback


SetTimer in Win32 with a TimerProc as the call back.

/* calls TimerProc once every 60000 milliseconds */SetTimer(NULL, 1, 60000, TimerProc);


You might want to try the POSIX interval timers, timer_create and timer_settime, as it allows you to specify a call back function directly without using signals. To get the timer to expire just once ( and not keep repeating ):

timer_settime: The reload value of the timer shall be set to the value specified by the it_interval member of value. When a timer is armed with a non-zero it_interval, a periodic (or repetitive) timer is specified.

Here is extensive documentation of using these timers with a nice example from the Linux Programmer's Manual on kernel.org:

timer_create - create a POSIX per-process timer