BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
libraries
fc
src
interprocess
signals.cpp
Go to the documentation of this file.
1
#include <
fc/asio.hpp
>
2
#include <boost/asio/signal_set.hpp>
3
4
namespace
fc
5
{
6
std::shared_ptr<boost::asio::signal_set>
set_signal_handler
( std::function<
void
(
int
)> handler,
int
signal_num )
7
{
8
std::shared_ptr<boost::asio::signal_set> sig_set(
new
boost::asio::signal_set(
fc::asio::default_io_service
(),
9
signal_num) );
10
sig_set->async_wait( [sig_set,handler](
const
boost::system::error_code& err,
int
num )
11
{
12
if
( err != boost::asio::error::operation_aborted )
13
handler( num );
14
sig_set->cancel();
15
} );
16
return
sig_set;
17
}
18
}
fc::set_signal_handler
std::shared_ptr< boost::asio::signal_set > set_signal_handler(std::function< void(int)> handler, int signal_num)
Definition:
signals.cpp:6
fc
Definition:
api.hpp:15
asio.hpp
fc::asio::default_io_service
boost::asio::io_service & default_io_service()
Definition:
asio.cpp:219
Generated on Fri Dec 15 2023 06:12:43 for BitShares-Core by
1.8.17