Realistic 3D camera system
3D camera system components
resolver_service_base.hpp
Go to the documentation of this file.
1 //
2 // detail/resolver_service_base.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_RESOLVER_SERVICE_BASE_HPP
12 #define ASIO_DETAIL_RESOLVER_SERVICE_BASE_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 #include "asio/error.hpp"
20 #include "asio/io_service.hpp"
21 #include "asio/detail/mutex.hpp"
27 #include "asio/detail/thread.hpp"
28 
30 
31 namespace asio {
32 namespace detail {
33 
35 {
36 public:
37  // The implementation type of the resolver. A cancellation token is used to
38  // indicate to the background thread that the operation has been cancelled.
40 
41  // Constructor.
43 
44  // Destructor.
46 
47  // Destroy all user-defined handler objects owned by the service.
49 
50  // Perform any fork-related housekeeping.
53 
54  // Construct a new resolver implementation.
55  ASIO_DECL void construct(implementation_type& impl);
56 
57  // Destroy a resolver implementation.
58  ASIO_DECL void destroy(implementation_type&);
59 
60  // Cancel pending asynchronous operations.
61  ASIO_DECL void cancel(implementation_type& impl);
62 
63 protected:
64  // Helper function to start an asynchronous resolve operation.
66 
67 #if !defined(ASIO_WINDOWS_RUNTIME)
68  // Helper class to perform exception-safe cleanup of addrinfo objects.
71  {
72  public:
74  : ai_(ai)
75  {
76  }
77 
79  {
80  if (ai_)
82  }
83 
85  {
86  return ai_;
87  }
88 
89  private:
91  };
92 #endif // !defined(ASIO_WINDOWS_RUNTIME)
93 
94  // Helper class to run the work io_service in a thread.
96 
97  // Start the work thread if it's not already running.
99 
100  // The io_service implementation used to post completions.
102 
103 private:
104  // Mutex to protect access to internal data.
105  asio::detail::mutex mutex_;
106 
107  // Private io_service used for performing asynchronous host resolution.
109 
110  // The work io_service implementation used to post completions.
111  io_service_impl& work_io_service_impl_;
112 
113  // Work for the private io_service to perform.
115 
116  // Thread used for running the work io_service's run loop.
118 };
119 
120 } // namespace detail
121 } // namespace asio
122 
124 
125 #if defined(ASIO_HEADER_ONLY)
127 #endif // defined(ASIO_HEADER_ONLY)
128 
129 #endif // ASIO_DETAIL_RESOLVER_SERVICE_BASE_HPP
ASIO_DECL void destroy(implementation_type &)
ASIO_DECL void construct(implementation_type &impl)
shared_ptr< void > shared_cancel_token_type
Definition: socket_ops.hpp:62
Provides core I/O functionality.
Definition: io_service.hpp:184
ASIO_DECL resolver_service_base(asio::io_service &io_service)
ASIO_DECL void start_resolve_op(operation *op)
class task_io_service io_service_impl
Definition: io_service.hpp:48
addrinfo addrinfo_type
ASIO_DECL void fork_service(asio::io_service::fork_event fork_ev)
ASIO_DECL void cancel(implementation_type &impl)
fork_event
Fork-related event notifications.
Definition: io_service.hpp:501
void freeaddrinfo(addrinfo_type *ai)
#define ASIO_DECL
Definition: config.hpp:43
task_io_service_operation operation
Definition: operation.hpp:32
socket_ops::shared_cancel_token_type implementation_type