Is it possible (preferably in an OS-independent fashion, although I happen to be using Windows) to request a timer interrupt in a userspace program?
Here is some pseudo-code which may illustrate what kind of functionality I'm looking for:
#include <time_library_x.h> //For setHandler() and set_timer_for_ms()
void timerInterruptHandler() {
update_something();
set_timer_for_ms(50);
}
void main() {
setHandler(timerInterruptHandler);
set_timer_for_ms(50);
while(1) {
very_boring_data_collection();
}
}
Anyone know what "library x" is?
In Windows, there is Timers object to create Timer object and register callback function.
In Linux using SIGALRM and setitimer is common to implement timer things, but I have not seen such libraries which integrates those for mult-platform use.
Windows Timers Example : https://msdn.microsoft.com/en-us/library/windows/desktop/ms644901(v=vs.85).aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With