| 100 | template <typename Allocator, unsigned int Bits> |
| 101 | template <typename Function> |
| 102 | void thread_pool::basic_executor_type<Allocator, |
| 103 | Bits>::do_execute(ASIO_MOVE_ARG(Function) f, false_type) const |
| 104 | { |
| 105 | typedef typename decay<Function>::type function_type; |
| 106 | |
| 107 | // Invoke immediately if the blocking.possibly property is enabled and we are |
| 108 | // already inside the thread pool. |
| 109 | if ((bits_ & blocking_never) == 0 && pool_->scheduler_.can_dispatch()) |
| 110 | { |
| 111 | // Make a local, non-const copy of the function. |
| 112 | function_type tmp(ASIO_MOVE_CAST(Function)(f)); |
| 113 | |
| 114 | #if defined(ASIO_HAS_STD_EXCEPTION_PTR) \ |
| 115 | && !defined(ASIO_NO_EXCEPTIONS) |
| 116 | try |
| 117 | { |
| 118 | #endif // defined(ASIO_HAS_STD_EXCEPTION_PTR) |
| 119 | // && !defined(ASIO_NO_EXCEPTIONS) |
| 120 | detail::fenced_block b(detail::fenced_block::full); |
| 121 | asio_handler_invoke_helpers::invoke(tmp, tmp); |
| 122 | return; |
| 123 | #if defined(ASIO_HAS_STD_EXCEPTION_PTR) \ |
| 124 | && !defined(ASIO_NO_EXCEPTIONS) |
| 125 | } |
| 126 | catch (...) |
| 127 | { |
| 128 | pool_->scheduler_.capture_current_exception(); |
| 129 | return; |
| 130 | } |
| 131 | #endif // defined(ASIO_HAS_STD_EXCEPTION_PTR) |
| 132 | // && !defined(ASIO_NO_EXCEPTIONS) |
| 133 | } |
| 134 | |
| 135 | // Allocate and construct an operation to wrap the function. |
| 136 | typedef detail::executor_op<function_type, Allocator> op; |
| 137 | typename op::ptr p = { detail::addressof(allocator_), |
| 138 | op::ptr::allocate(allocator_), 0 }; |
| 139 | p.p = new (p.v) op(ASIO_MOVE_CAST(Function)(f), allocator_); |
| 140 | |
| 141 | if ((bits_ & relationship_continuation) != 0) |
| 142 | { |
| 143 | ASIO_HANDLER_CREATION((*pool_, *p.p, |
| 144 | "thread_pool", pool_, 0, "execute(blk=never,rel=cont)")); |
| 145 | } |
| 146 | else |
| 147 | { |
| 148 | ASIO_HANDLER_CREATION((*pool_, *p.p, |
| 149 | "thread_pool", pool_, 0, "execute(blk=never,rel=fork)")); |
| 150 | } |
| 151 | |
| 152 | pool_->scheduler_.post_immediate_completion(p.p, |
| 153 | (bits_ & relationship_continuation) != 0); |
| 154 | p.v = p.p = 0; |
| 155 | } |
| 156 | |
| 157 | template <typename Allocator, unsigned int Bits> |
| 158 | template <typename Function> |
no test coverage detected