Reputation: 186
I am new to callback functions in C. I want to create a timed callback.
Scenario: I want a timer function which will trigger the callback function when timer expires. For example, every 5 sec the timer expires and calls the function.
How should I approach this problem ?
Upvotes: 0
Views: 4098
Reputation: 4366
As with all problems:
What you want to do precisely
You want to "create a timed callback". I think this means :
foo
doing some workfoo
" anywhere in your programHow would you do this yourself?
I think you would, for example, launch a stopwatch with X miliseconds then keep doing whatever you were doing. When the stopwatch reaches zero, you stop what you do and do the thing needed. Finally, resume what you were doing.
What blocks you?
Judging by your question I think two things block you:
A few google searches will help you with both.
Upvotes: 3