mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
37 lines
731 B
C++
37 lines
731 B
C++
//
|
|
// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
|
|
//
|
|
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
//
|
|
|
|
#ifndef BEAST_TEST_SIG_WAIT_HPP
|
|
#define BEAST_TEST_SIG_WAIT_HPP
|
|
|
|
#include <boost/asio.hpp>
|
|
#include <condition_variable>
|
|
#include <mutex>
|
|
|
|
namespace beast {
|
|
namespace test {
|
|
|
|
/// Block until SIGINT or SIGTERM is received.
|
|
inline
|
|
void
|
|
sig_wait()
|
|
{
|
|
boost::asio::io_service ios;
|
|
boost::asio::signal_set signals(
|
|
ios, SIGINT, SIGTERM);
|
|
signals.async_wait(
|
|
[&](boost::system::error_code const&, int)
|
|
{
|
|
});
|
|
ios.run();
|
|
}
|
|
|
|
} // test
|
|
} // beast
|
|
|
|
#endif
|