adding missing files
This commit is contained in:
parent
ee8125050b
commit
76b13a741a
4 changed files with 27 additions and 1 deletions
|
|
@ -91,6 +91,7 @@ set( fc_sources
|
||||||
src/io/varint.cpp
|
src/io/varint.cpp
|
||||||
src/filesystem.cpp
|
src/filesystem.cpp
|
||||||
src/interprocess/process.cpp
|
src/interprocess/process.cpp
|
||||||
|
src/interprocess/signals.cpp
|
||||||
src/interprocess/file_mapping.cpp
|
src/interprocess/file_mapping.cpp
|
||||||
src/interprocess/mmap_struct.cpp
|
src/interprocess/mmap_struct.cpp
|
||||||
src/rpc/json_connection.cpp
|
src/rpc/json_connection.cpp
|
||||||
|
|
|
||||||
8
include/fc/interprocess/signals.hpp
Normal file
8
include/fc/interprocess/signals.hpp
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
#pragma once
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
/// handler will be called from ASIO thread
|
||||||
|
void set_signal_handler( std::function<void(int)> handler, int signal_num );
|
||||||
|
}
|
||||||
|
|
@ -106,7 +106,7 @@ namespace fc {
|
||||||
{
|
{
|
||||||
delete the_work;
|
delete the_work;
|
||||||
io->stop();
|
io->stop();
|
||||||
asio_thread->join();
|
// TODO: this hangs sometimes.. asio_thread->join();
|
||||||
delete io;
|
delete io;
|
||||||
delete asio_thread;
|
delete asio_thread;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
17
src/interprocess/signals.cpp
Normal file
17
src/interprocess/signals.cpp
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include <fc/asio.hpp>
|
||||||
|
#include <boost/asio/signal_set.hpp>
|
||||||
|
|
||||||
|
namespace fc
|
||||||
|
{
|
||||||
|
void set_signal_handler( std::function<void(int)> handler, int signal_num )
|
||||||
|
{
|
||||||
|
std::shared_ptr<boost::asio::signal_set> sig_set(new boost::asio::signal_set(fc::asio::default_io_service(), signal_num));
|
||||||
|
sig_set->async_wait(
|
||||||
|
[sig_set,handler]( const boost::system::error_code& err, int num )
|
||||||
|
{
|
||||||
|
handler( num );
|
||||||
|
sig_set->cancel();
|
||||||
|
// set_signal_handler( handler, signal_num );
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue