| Home | Libraries | People | FAQ | More

# Source listing for Timer.2

    #include <iostream>
    #include <boost/asio.hpp>
    #include <boost/date_time/posix_time/posix_time.hpp>

    void print(const boost::asio::error& /*e*/)
    {
      std::cout << "Hello, world!\n";
    }

    int main()
    {
      boost::asio::io_service io;

      boost::asio::deadline_timer t(io, boost::posix_time::seconds(5));
      t.async_wait(print);

      io.run();

      return 0;
    }

Return to Timer.2 - Using a timer asynchronously

| Copyright © 2003 - 2006 Christopher M. Kohlhoff