]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | // |
92f5a8d4 | 2 | // Copyright (c) 2016-2019 Vinnie Falco (vinnie dot falco at gmail dot com) |
7c673cae FG |
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 | // | |
b32b8144 FG |
7 | // Official repository: https://github.com/boostorg/beast |
8 | // | |
7c673cae | 9 | |
b32b8144 FG |
10 | #ifndef BOOST_BEAST_TEST_SIG_WAIT_HPP |
11 | #define BOOST_BEAST_TEST_SIG_WAIT_HPP | |
7c673cae FG |
12 | |
13 | #include <boost/asio.hpp> | |
14 | ||
b32b8144 | 15 | namespace boost { |
7c673cae FG |
16 | namespace beast { |
17 | namespace test { | |
18 | ||
19 | /// Block until SIGINT or SIGTERM is received. | |
20 | inline | |
21 | void | |
22 | sig_wait() | |
23 | { | |
92f5a8d4 TL |
24 | net::io_context ioc; |
25 | net::signal_set signals( | |
b32b8144 | 26 | ioc, SIGINT, SIGTERM); |
7c673cae FG |
27 | signals.async_wait( |
28 | [&](boost::system::error_code const&, int) | |
29 | { | |
30 | }); | |
b32b8144 | 31 | ioc.run(); |
7c673cae FG |
32 | } |
33 | ||
34 | } // test | |
35 | } // beast | |
b32b8144 | 36 | } // boost |
7c673cae FG |
37 | |
38 | #endif |