]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/example/cpp03/tutorial/timer4/timer.cpp
5 // Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
12 #include <boost/asio.hpp>
13 #include <boost/bind.hpp>
14 #include <boost/date_time/posix_time/posix_time.hpp>
19 printer(boost::asio::io_service
& io
)
20 : timer_(io
, boost::posix_time::seconds(1)),
23 timer_
.async_wait(boost::bind(&printer::print
, this));
28 std::cout
<< "Final count is " << count_
<< std::endl
;
35 std::cout
<< count_
<< std::endl
;
38 timer_
.expires_at(timer_
.expires_at() + boost::posix_time::seconds(1));
39 timer_
.async_wait(boost::bind(&printer::print
, this));
44 boost::asio::deadline_timer timer_
;
50 boost::asio::io_service io
;