aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asio/impl/thread_pool.hpp
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-10-07 04:52:50 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-10-07 04:52:50 +0200
commit0aa6201a490bfabc0ae021ceb9f1fb0f46727c5d (patch)
treea71d934d8151dd43e7c16555fef17fd749c5da70 /lib/asio/impl/thread_pool.hpp
parent558d74bffd9f069955af52c0b308a1d6169bcff0 (diff)
parent0330221d51421caa110b8c5dcb567cc3d0620eb9 (diff)
downloaddabmod-0aa6201a490bfabc0ae021ceb9f1fb0f46727c5d.tar.gz
dabmod-0aa6201a490bfabc0ae021ceb9f1fb0f46727c5d.tar.bz2
dabmod-0aa6201a490bfabc0ae021ceb9f1fb0f46727c5d.zip
Merge lime output into next branch
Diffstat (limited to 'lib/asio/impl/thread_pool.hpp')
-rw-r--r--lib/asio/impl/thread_pool.hpp127
1 files changed, 0 insertions, 127 deletions
diff --git a/lib/asio/impl/thread_pool.hpp b/lib/asio/impl/thread_pool.hpp
deleted file mode 100644
index 058e377..0000000
--- a/lib/asio/impl/thread_pool.hpp
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// impl/thread_pool.hpp
-// ~~~~~~~~~~~~~~~~~~~~
-//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef ASIO_IMPL_THREAD_POOL_HPP
-#define ASIO_IMPL_THREAD_POOL_HPP
-
-#if defined(_MSC_VER) && (_MSC_VER >= 1200)
-# pragma once
-#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-
-#include "asio/detail/executor_op.hpp"
-#include "asio/detail/fenced_block.hpp"
-#include "asio/detail/recycling_allocator.hpp"
-#include "asio/detail/type_traits.hpp"
-#include "asio/execution_context.hpp"
-
-#include "asio/detail/push_options.hpp"
-
-namespace asio {
-
-inline thread_pool::executor_type
-thread_pool::get_executor() ASIO_NOEXCEPT
-{
- return executor_type(*this);
-}
-
-inline thread_pool&
-thread_pool::executor_type::context() const ASIO_NOEXCEPT
-{
- return pool_;
-}
-
-inline void
-thread_pool::executor_type::on_work_started() const ASIO_NOEXCEPT
-{
- pool_.scheduler_.work_started();
-}
-
-inline void thread_pool::executor_type::on_work_finished()
-const ASIO_NOEXCEPT
-{
- pool_.scheduler_.work_finished();
-}
-
-template <typename Function, typename Allocator>
-void thread_pool::executor_type::dispatch(
- ASIO_MOVE_ARG(Function) f, const Allocator& a) const
-{
- typedef typename decay<Function>::type function_type;
-
- // Invoke immediately if we are already inside the thread pool.
- if (pool_.scheduler_.can_dispatch())
- {
- // Make a local, non-const copy of the function.
- function_type tmp(ASIO_MOVE_CAST(Function)(f));
-
- detail::fenced_block b(detail::fenced_block::full);
- asio_handler_invoke_helpers::invoke(tmp, tmp);
- return;
- }
-
- // Allocate and construct an operation to wrap the function.
- typedef detail::executor_op<function_type, Allocator> op;
- typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
- p.p = new (p.v) op(ASIO_MOVE_CAST(Function)(f), a);
-
- ASIO_HANDLER_CREATION((pool_, *p.p,
- "thread_pool", &this->context(), 0, "dispatch"));
-
- pool_.scheduler_.post_immediate_completion(p.p, false);
- p.v = p.p = 0;
-}
-
-template <typename Function, typename Allocator>
-void thread_pool::executor_type::post(
- ASIO_MOVE_ARG(Function) f, const Allocator& a) const
-{
- typedef typename decay<Function>::type function_type;
-
- // Allocate and construct an operation to wrap the function.
- typedef detail::executor_op<function_type, Allocator> op;
- typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
- p.p = new (p.v) op(ASIO_MOVE_CAST(Function)(f), a);
-
- ASIO_HANDLER_CREATION((pool_, *p.p,
- "thread_pool", &this->context(), 0, "post"));
-
- pool_.scheduler_.post_immediate_completion(p.p, false);
- p.v = p.p = 0;
-}
-
-template <typename Function, typename Allocator>
-void thread_pool::executor_type::defer(
- ASIO_MOVE_ARG(Function) f, const Allocator& a) const
-{
- typedef typename decay<Function>::type function_type;
-
- // Allocate and construct an operation to wrap the function.
- typedef detail::executor_op<function_type, Allocator> op;
- typename op::ptr p = { detail::addressof(a), op::ptr::allocate(a), 0 };
- p.p = new (p.v) op(ASIO_MOVE_CAST(Function)(f), a);
-
- ASIO_HANDLER_CREATION((pool_, *p.p,
- "thread_pool", &this->context(), 0, "defer"));
-
- pool_.scheduler_.post_immediate_completion(p.p, true);
- p.v = p.p = 0;
-}
-
-inline bool
-thread_pool::executor_type::running_in_this_thread() const ASIO_NOEXCEPT
-{
- return pool_.scheduler_.can_dispatch();
-}
-
-} // namespace asio
-
-#include "asio/detail/pop_options.hpp"
-
-#endif // ASIO_IMPL_THREAD_POOL_HPP