Realistic 3D camera system
3D camera system components
task_io_service.hpp
Go to the documentation of this file.
1 //
2 // detail/impl/task_io_service.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_IMPL_TASK_IO_SERVICE_HPP
12 #define ASIO_DETAIL_IMPL_TASK_IO_SERVICE_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
24 
26 
27 namespace asio {
28 namespace detail {
29 
30 template <typename Handler>
31 void task_io_service::dispatch(Handler& handler)
32 {
34  {
36  asio_handler_invoke_helpers::invoke(handler, handler);
37  }
38  else
39  {
40  // Allocate and construct an operation to wrap the handler.
41  typedef completion_handler<Handler> op;
42  typename op::ptr p = { asio::detail::addressof(handler),
44  sizeof(op), handler), 0 };
45  p.p = new (p.v) op(handler);
46 
47  ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch"));
48 
49  do_dispatch(p.p);
50  p.v = p.p = 0;
51  }
52 }
53 
54 template <typename Handler>
55 void task_io_service::post(Handler& handler)
56 {
57  bool is_continuation =
59 
60  // Allocate and construct an operation to wrap the handler.
61  typedef completion_handler<Handler> op;
62  typename op::ptr p = { asio::detail::addressof(handler),
64  sizeof(op), handler), 0 };
65  p.p = new (p.v) op(handler);
66 
67  ASIO_HANDLER_CREATION((p.p, "io_service", this, "post"));
68 
69  post_immediate_completion(p.p, is_continuation);
70  p.v = p.p = 0;
71 }
72 
73 } // namespace detail
74 } // namespace asio
75 
77 
78 #endif // ASIO_DETAIL_IMPL_TASK_IO_SERVICE_HPP
asio::basic_streambuf< Allocator > & b
Definition: read.hpp:702
static Value * contains(Key *k)
Definition: call_stack.hpp:92
void invoke(Function &function, Context &context)
void post(Handler &handler)
bool is_continuation(Context &context)
void dispatch(Handler &handler)
void * allocate(std::size_t s, Handler &h)
#define ASIO_HANDLER_CREATION(args)
ASIO_DECL void post_immediate_completion(operation *op, bool is_continuation)