]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // |
2 | // Copyright (c) 2013-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 | ||
8 | #ifndef BEAST_TEST_SIG_WAIT_HPP | |
9 | #define BEAST_TEST_SIG_WAIT_HPP | |
10 | ||
11 | #include <boost/asio.hpp> | |
12 | ||
13 | namespace beast { | |
14 | namespace test { | |
15 | ||
16 | /// Block until SIGINT or SIGTERM is received. | |
17 | inline | |
18 | void | |
19 | sig_wait() | |
20 | { | |
21 | boost::asio::io_service ios; | |
22 | boost::asio::signal_set signals( | |
23 | ios, SIGINT, SIGTERM); | |
24 | signals.async_wait( | |
25 | [&](boost::system::error_code const&, int) | |
26 | { | |
27 | }); | |
28 | ios.run(); | |
29 | } | |
30 | ||
31 | } // test | |
32 | } // beast | |
33 | ||
34 | #endif |