c++ Implementing Timed Callback function
I want to implement some system in c++ so that I can call a function and ask for another function to be called in X milliseconds. Something like this: callfunctiontimed(25, funcName); 25 being the amount of milliseconds before the function should be called. I would like to know if multithreading is required for this and then use some delay function? Other than using function pointer how would a feature like this work? For a portable solution, you can use boost::asio. Below is a demo I wrote a while ago. You can change t.expires_from_now(boost::posix_time::seconds(1)); to suit you need say make