|
||||
File indexing completed on 2025-01-18 09:28:38
0001 // 0002 // detail/eventfd_select_interrupter.hpp 0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 0004 // 0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com) 0006 // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) 0007 // 0008 // Distributed under the Boost Software License, Version 1.0. (See accompanying 0009 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 0010 // 0011 0012 #ifndef BOOST_ASIO_DETAIL_EVENTFD_SELECT_INTERRUPTER_HPP 0013 #define BOOST_ASIO_DETAIL_EVENTFD_SELECT_INTERRUPTER_HPP 0014 0015 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 0016 # pragma once 0017 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 0018 0019 #include <boost/asio/detail/config.hpp> 0020 0021 #if defined(BOOST_ASIO_HAS_EVENTFD) 0022 0023 #include <boost/asio/detail/push_options.hpp> 0024 0025 namespace boost { 0026 namespace asio { 0027 namespace detail { 0028 0029 class eventfd_select_interrupter 0030 { 0031 public: 0032 // Constructor. 0033 BOOST_ASIO_DECL eventfd_select_interrupter(); 0034 0035 // Destructor. 0036 BOOST_ASIO_DECL ~eventfd_select_interrupter(); 0037 0038 // Recreate the interrupter's descriptors. Used after a fork. 0039 BOOST_ASIO_DECL void recreate(); 0040 0041 // Interrupt the select call. 0042 BOOST_ASIO_DECL void interrupt(); 0043 0044 // Reset the select interrupter. Returns true if the reset was successful. 0045 BOOST_ASIO_DECL bool reset(); 0046 0047 // Get the read descriptor to be passed to select. 0048 int read_descriptor() const 0049 { 0050 return read_descriptor_; 0051 } 0052 0053 private: 0054 // Open the descriptors. Throws on error. 0055 BOOST_ASIO_DECL void open_descriptors(); 0056 0057 // Close the descriptors. 0058 BOOST_ASIO_DECL void close_descriptors(); 0059 0060 // The read end of a connection used to interrupt the select call. This file 0061 // descriptor is passed to select such that when it is time to stop, a single 0062 // 64bit value will be written on the other end of the connection and this 0063 // descriptor will become readable. 0064 int read_descriptor_; 0065 0066 // The write end of a connection used to interrupt the select call. A single 0067 // 64bit non-zero value may be written to this to wake up the select which is 0068 // waiting for the other end to become readable. This descriptor will only 0069 // differ from the read descriptor when a pipe is used. 0070 int write_descriptor_; 0071 }; 0072 0073 } // namespace detail 0074 } // namespace asio 0075 } // namespace boost 0076 0077 #include <boost/asio/detail/pop_options.hpp> 0078 0079 #if defined(BOOST_ASIO_HEADER_ONLY) 0080 # include <boost/asio/detail/impl/eventfd_select_interrupter.ipp> 0081 #endif // defined(BOOST_ASIO_HEADER_ONLY) 0082 0083 #endif // defined(BOOST_ASIO_HAS_EVENTFD) 0084 0085 #endif // BOOST_ASIO_DETAIL_EVENTFD_SELECT_INTERRUPTER_HPP
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |