]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/asio/example/cpp03/tutorial/timer4/timer.cpp
afcdcb396995d9c910af91ef8e77401ca9d6c97e
5 // Copyright (c) 2003-2020 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/bind.hpp>
18 printer(boost::asio::io_context
& io
)
19 : timer_(io
, boost::asio::chrono::seconds(1)),
22 timer_
.async_wait(boost::bind(&printer::print
, this));
27 std::cout
<< "Final count is " << count_
<< std::endl
;
34 std::cout
<< count_
<< std::endl
;
37 timer_
.expires_at(timer_
.expiry() + boost::asio::chrono::seconds(1));
38 timer_
.async_wait(boost::bind(&printer::print
, this));
43 boost::asio::steady_timer timer_
;
49 boost::asio::io_context io
;