// // timer.cpp // ~~~~~~~~~ // // Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include #include #include #include void print(const boost::system::error_code&, int interval /*e*/) { while(true) { boost::this_thread::sleep(boost::posix_time::seconds(interval)); std::cout << "\n Make async Call here"; } } int main() { boost::asio::io_service io; boost::asio::deadline_timer t(io, boost::posix_time::seconds(1)); int interval = 3; t.async_wait(boost::bind(&print, boost::asio::placeholders::error, interval)); std::cout << "\nAfter async_wait"; io.run(); return 0; }