Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C Timer Callback

Interested in something similar to JavaScript setTimeout in C on both UNIX and Windows.

Basically, I want:

start_timer(&function_pointer, int time_in_secs)

or as close to that as I can get.

Also, something similar to setInterval would be nice (where it calls the callback every n seconds), but that can be implemented using setTimeout :)

like image 537
singpolyma Avatar asked May 15 '09 01:05

singpolyma


1 Answers

SetTimer in Win32 with a TimerProc as the call back.

/* calls TimerProc once every 60000 milliseconds */
SetTimer(NULL, 1, 60000, TimerProc);
like image 119
scottm Avatar answered Sep 19 '22 22:09

scottm