Realistic 3D camera system
3D camera system components
pipe_select_interrupter.hpp
Go to the documentation of this file.
1 //
2 // detail/pipe_select_interrupter.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP
12 #define ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if !defined(ASIO_WINDOWS)
21 #if !defined(ASIO_WINDOWS_RUNTIME)
22 #if !defined(__CYGWIN__)
23 #if !defined(__SYMBIAN32__)
24 #if !defined(ASIO_HAS_EVENTFD)
25 
27 
28 namespace asio {
29 namespace detail {
30 
32 {
33 public:
34  // Constructor.
36 
37  // Destructor.
39 
40  // Recreate the interrupter's descriptors. Used after a fork.
41  ASIO_DECL void recreate();
42 
43  // Interrupt the select call.
44  ASIO_DECL void interrupt();
45 
46  // Reset the select interrupt. Returns true if the call was interrupted.
47  ASIO_DECL bool reset();
48 
49  // Get the read descriptor to be passed to select.
50  int read_descriptor() const
51  {
52  return read_descriptor_;
53  }
54 
55 private:
56  // Open the descriptors. Throws on error.
57  ASIO_DECL void open_descriptors();
58 
59  // Close the descriptors.
60  ASIO_DECL void close_descriptors();
61 
62  // The read end of a connection used to interrupt the select call. This file
63  // descriptor is passed to select such that when it is time to stop, a single
64  // byte will be written on the other end of the connection and this
65  // descriptor will become readable.
66  int read_descriptor_;
67 
68  // The write end of a connection used to interrupt the select call. A single
69  // byte may be written to this to wake up the select which is waiting for the
70  // other end to become readable.
71  int write_descriptor_;
72 };
73 
74 } // namespace detail
75 } // namespace asio
76 
78 
79 #if defined(ASIO_HEADER_ONLY)
81 #endif // defined(ASIO_HEADER_ONLY)
82 
83 #endif // !defined(ASIO_HAS_EVENTFD)
84 #endif // !defined(__SYMBIAN32__)
85 #endif // !defined(__CYGWIN__)
86 #endif // !defined(ASIO_WINDOWS_RUNTIME)
87 #endif // !defined(ASIO_WINDOWS)
88 
89 #endif // ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP
#define ASIO_DECL
Definition: config.hpp:43