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/strand.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/strand.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/asio/strand.hpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/3rdParty/Boost/src/boost/asio/strand.hpp b/3rdParty/Boost/src/boost/asio/strand.hpp index 6a1033f..f6b62fb 100644 --- a/3rdParty/Boost/src/boost/asio/strand.hpp +++ b/3rdParty/Boost/src/boost/asio/strand.hpp @@ -2,7 +2,7 @@ // strand.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) @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <boost/asio/async_result.hpp> #include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/strand_service.hpp> #include <boost/asio/detail/wrapped_handler.hpp> @@ -72,6 +73,9 @@ namespace asio { * happens-before the other. Therefore none of the above conditions are met and * no ordering guarantee is made. * + * @note The implementation makes no guarantee that handlers posted or + * dispatched through different @c strand objects will be invoked concurrently. + * * @par Thread Safety * @e Distinct @e objects: Safe.@n * @e Shared @e objects: Safe. @@ -140,13 +144,20 @@ public: * @code void handler(); @endcode */ template <typename CompletionHandler> - void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) + BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a CompletionHandler. BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; - service_.dispatch(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); + detail::async_result_init< + CompletionHandler, void ()> init( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); + + service_.dispatch(impl_, init.handler); + + return init.result.get(); } /// Request the strand to invoke the given handler and return @@ -166,13 +177,20 @@ public: * @code void handler(); @endcode */ template <typename CompletionHandler> - void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) + BOOST_ASIO_INITFN_RESULT_TYPE(CompletionHandler, void ()) + post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { // If you get an error on the following line it means that your handler does // not meet the documented type requirements for a CompletionHandler. BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; - service_.post(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); + detail::async_result_init< + CompletionHandler, void ()> init( + BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); + + service_.post(impl_, init.handler); + + return init.result.get(); } /// Create a new handler that automatically dispatches the wrapped handler @@ -200,11 +218,23 @@ public: #if defined(GENERATING_DOCUMENTATION) unspecified #else - detail::wrapped_handler<strand, Handler> + detail::wrapped_handler<strand, Handler, detail::is_continuation_if_running> #endif wrap(Handler handler) { - return detail::wrapped_handler<io_service::strand, Handler>(*this, handler); + return detail::wrapped_handler<io_service::strand, Handler, + detail::is_continuation_if_running>(*this, handler); + } + + /// Determine whether the strand is running in the current thread. + /** + * @return @c true if the current thread is executing a handler that was + * submitted to the strand using post(), dispatch() or wrap(). Otherwise + * returns @c false. + */ + bool running_in_this_thread() const + { + return service_.running_in_this_thread(impl_); } private: |