]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/beast/test/extras/include/boost/beast/test/sig_wait.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / beast / test / extras / include / boost / beast / test / sig_wait.hpp
1 //
2 // Copyright (c) 2016-2017 Vinnie Falco (vinnie dot falco at gmail dot com)
3 //
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //
7 // Official repository: https://github.com/boostorg/beast
8 //
9
10 #ifndef BOOST_BEAST_TEST_SIG_WAIT_HPP
11 #define BOOST_BEAST_TEST_SIG_WAIT_HPP
12
13 #include <boost/asio.hpp>
14
15 namespace boost {
16 namespace beast {
17 namespace test {
18
19 /// Block until SIGINT or SIGTERM is received.
20 inline
21 void
22 sig_wait()
23 {
24 boost::asio::io_context ioc;
25 boost::asio::signal_set signals(
26 ioc, SIGINT, SIGTERM);
27 signals.async_wait(
28 [&](boost::system::error_code const&, int)
29 {
30 });
31 ioc.run();
32 }
33
34 } // test
35 } // beast
36 } // boost
37
38 #endif