// Copyright (c) 2009 Dmitry Goncharov // // 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 BOOST_ASIO_POSIX_SIGNAL_HANDLER_HPP #define BOOST_ASIO_POSIX_SIGNAL_HANDLER_HPP #include #include #include #include #if defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) \ || defined(GENERATING_DOCUMENTATION) namespace boost { namespace asio { namespace posix { template class signal_handler { public: explicit signal_handler(io_service& ios) : m_sd(ios, m_sigfd.fd()) {} template void async_wait(Handler h) { async_read(m_sd, buffer(&m_buf, sizeof m_buf), h); } private: signal_handler(signal_handler const&); signal_handler const& operator=(signal_handler const&); private: signalfd m_sigfd; stream_descriptor m_sd; typename signalfd::buf_type m_buf; }; }}} #endif // defined(BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR) // || defined(GENERATING_DOCUMENTATION) #endif