August 2017
Intermediate to advanced
438 pages
14h 19m
English
In short, when a specified amount of time is passed, boost::asio::deadline_timer pushes the task to the instance of boost::asio::io_service class for execution.
All the nasty stuff is inside the run_delayed function:
template <class Time, class Functor> static void run_delayed(Time duration_or_time, const Functor& f) { std::unique_ptr<boost::asio::deadline_timer> timer( /* ... */ ); boost::asio::deadline_timer& timer_ref = *timer; timer_ref.async_wait( detail::timer_task<Functor>( std::move(timer), f ) ); }
The tasks_processor::run_delayed function accepts a timeout and a functor to call after the timeout. In it, a unique pointer to boost::asio::deadline_timer is created. boost::asio::deadline_timer holds platform-specific ...
Read now
Unlock full access