#include #include struct simple_handler { void operator()(const boost::system::error_code& ec) { std::cout << "tick!" << std::endl; } }; inline void* asio_handler_allocate(std::size_t size, simple_handler* handler) { void* res = ::operator new(size); std::cout << "allocate " << res << std::endl; return res; } inline void asio_handler_deallocate(void* pointer, std::size_t size, simple_handler* handler) { std::cout << "deallocate " << pointer << std::endl; ::operator delete(pointer); } int main(int argc, char* argv[]) { boost::asio::io_service ios; boost::asio::deadline_timer timer(ios, boost::posix_time::milliseconds(1000)); timer.async_wait(simple_handler()); ios.run(); }