I am creating a TaskScheduler, which schedules a handler at give time-duration and execute it when timer expires. Under the hood, it is using asio::deadline_timer. As per the documentation of asio::io_service, the handler will be invoked in the thread context where io_server::run() function is running. While my requirement is to call handler in different thread context.
How can we achieve it? Precisely my question is that, How can we execute a function in different thread context. E.g. I am current in Thread1 but from Thread1, I want to run some function from Thread2 context.
Thanks