Statistics
| Revision:

root / tmp / org.txm.statsengine.r.core.win32 / res / win32 / library / BH / include / boost / asio / detail / pipe_select_interrupter.hpp @ 2486

History | View | Annotate | Download (2.5 kB)

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 BOOST_ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP
12
#define BOOST_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 <boost/asio/detail/config.hpp>
19

    
20
#if !defined(BOOST_ASIO_WINDOWS)
21
#if !defined(BOOST_ASIO_WINDOWS_RUNTIME)
22
#if !defined(__CYGWIN__)
23
#if !defined(__SYMBIAN32__)
24
#if !defined(BOOST_ASIO_HAS_EVENTFD)
25

    
26
#include <boost/asio/detail/push_options.hpp>
27

    
28
namespace boost {
29
namespace asio {
30
namespace detail {
31

    
32
class pipe_select_interrupter
33
{
34
public:
35
  // Constructor.
36
  BOOST_ASIO_DECL pipe_select_interrupter();
37

    
38
  // Destructor.
39
  BOOST_ASIO_DECL ~pipe_select_interrupter();
40

    
41
  // Recreate the interrupter's descriptors. Used after a fork.
42
  BOOST_ASIO_DECL void recreate();
43

    
44
  // Interrupt the select call.
45
  BOOST_ASIO_DECL void interrupt();
46

    
47
  // Reset the select interrupt. Returns true if the call was interrupted.
48
  BOOST_ASIO_DECL bool reset();
49

    
50
  // Get the read descriptor to be passed to select.
51
  int read_descriptor() const
52
  {
53
    return read_descriptor_;
54
  }
55

    
56
private:
57
  // Open the descriptors. Throws on error.
58
  BOOST_ASIO_DECL void open_descriptors();
59

    
60
  // Close the descriptors.
61
  BOOST_ASIO_DECL void close_descriptors();
62

    
63
  // The read end of a connection used to interrupt the select call. This file
64
  // descriptor is passed to select such that when it is time to stop, a single
65
  // byte will be written on the other end of the connection and this
66
  // descriptor will become readable.
67
  int read_descriptor_;
68

    
69
  // The write end of a connection used to interrupt the select call. A single
70
  // byte may be written to this to wake up the select which is waiting for the
71
  // other end to become readable.
72
  int write_descriptor_;
73
};
74

    
75
} // namespace detail
76
} // namespace asio
77
} // namespace boost
78

    
79
#include <boost/asio/detail/pop_options.hpp>
80

    
81
#if defined(BOOST_ASIO_HEADER_ONLY)
82
# include <boost/asio/detail/impl/pipe_select_interrupter.ipp>
83
#endif // defined(BOOST_ASIO_HEADER_ONLY)
84

    
85
#endif // !defined(BOOST_ASIO_HAS_EVENTFD)
86
#endif // !defined(__SYMBIAN32__)
87
#endif // !defined(__CYGWIN__)
88
#endif // !defined(BOOST_ASIO_WINDOWS_RUNTIME)
89
#endif // !defined(BOOST_ASIO_WINDOWS)
90

    
91
#endif // BOOST_ASIO_DETAIL_PIPE_SELECT_INTERRUPTER_HPP