diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp | 51 |
1 files changed, 16 insertions, 35 deletions
diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp index e05c3a7..a30ea04 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2014 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) @@ -23,10 +23,10 @@ #include <boost/asio/io_service.hpp> #include <boost/asio/detail/atomic_count.hpp> #include <boost/asio/detail/call_stack.hpp> +#include <boost/asio/detail/event.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_fwd.hpp> -#include <boost/asio/detail/task_io_service_fwd.hpp> #include <boost/asio/detail/task_io_service_operation.hpp> #include <boost/asio/detail/push_options.hpp> @@ -35,6 +35,8 @@ namespace boost { namespace asio { namespace detail { +struct task_io_service_thread_info; + class task_io_service : public boost::asio::detail::service_base<task_io_service> { @@ -94,15 +96,16 @@ public: // Request invocation of the given handler. template <typename Handler> - void dispatch(Handler handler); + void dispatch(Handler& handler); // Request invocation of the given handler and return immediately. template <typename Handler> - void post(Handler handler); + void post(Handler& handler); // Request invocation of the given operation and return immediately. Assumes // that work_started() has not yet been called for the operation. - BOOST_ASIO_DECL void post_immediate_completion(operation* op); + BOOST_ASIO_DECL void post_immediate_completion( + operation* op, bool is_continuation); // Request invocation of the given operation and return immediately. Assumes // that work_started() was previously called for the operation. @@ -112,33 +115,17 @@ public: // that work_started() was previously called for each operation. BOOST_ASIO_DECL void post_deferred_completions(op_queue<operation>& ops); - // Request invocation of the given operation, preferring the thread-private - // queue if available, and return immediately. Assumes that work_started() - // has not yet been called for the operation. - BOOST_ASIO_DECL void post_private_immediate_completion(operation* op); - - // Request invocation of the given operation, preferring the thread-private - // queue if available, and return immediately. Assumes that work_started() - // was previously called for the operation. - BOOST_ASIO_DECL void post_private_deferred_completion(operation* op); - // Process unfinished operations as part of a shutdown_service operation. // Assumes that work_started() was previously called for the operations. BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops); private: - // Structure containing information about an idle thread. - struct thread_info; - - // Request invocation of the given operation, avoiding the thread-private - // queue, and return immediately. Assumes that work_started() has not yet - // been called for the operation. - BOOST_ASIO_DECL void post_non_private_immediate_completion(operation* op); + // Structure containing thread-specific data. + typedef task_io_service_thread_info thread_info; - // Request invocation of the given operation, avoiding the thread-private - // queue, and return immediately. Assumes that work_started() was previously - // called for the operation. - BOOST_ASIO_DECL void post_non_private_deferred_completion(operation* op); + // Enqueue the given operation following a failed attempt to dispatch the + // operation for immediate invocation. + BOOST_ASIO_DECL void do_dispatch(operation* op); // Run at most one operation. May block. BOOST_ASIO_DECL std::size_t do_run_one(mutex::scoped_lock& lock, @@ -151,12 +138,6 @@ private: // Stop the task and all idle threads. BOOST_ASIO_DECL void stop_all_threads(mutex::scoped_lock& lock); - // Wakes a single idle thread and unlocks the mutex. Returns true if an idle - // thread was found. If there is no idle thread, returns false and leaves the - // mutex locked. - BOOST_ASIO_DECL bool wake_one_idle_thread_and_unlock( - mutex::scoped_lock& lock); - // Wake a single idle thread, or the task, and always unlock the mutex. BOOST_ASIO_DECL void wake_one_thread_and_unlock( mutex::scoped_lock& lock); @@ -175,6 +156,9 @@ private: // Mutex to protect access to internal data. mutable mutex mutex_; + // Event to wake up blocked threads. + event wakeup_event_; + // The task to be run by this service. reactor* task_; @@ -201,9 +185,6 @@ private: // Per-thread call stack to track the state of each thread in the io_service. typedef call_stack<task_io_service, thread_info> thread_call_stack; - - // The threads that are currently idle. - thread_info* first_idle_thread_; }; } // namespace detail |