diff options
Diffstat (limited to '3rdparty/asio/include/asio/detail/winrt_async_manager.hpp')
-rw-r--r-- | 3rdparty/asio/include/asio/detail/winrt_async_manager.hpp | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/3rdparty/asio/include/asio/detail/winrt_async_manager.hpp b/3rdparty/asio/include/asio/detail/winrt_async_manager.hpp index 921dfdd6274..ee7d4f691a6 100644 --- a/3rdparty/asio/include/asio/detail/winrt_async_manager.hpp +++ b/3rdparty/asio/include/asio/detail/winrt_async_manager.hpp @@ -2,7 +2,7 @@ // detail/winrt_async_manager.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2016 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2021 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,7 +23,13 @@ #include "asio/detail/atomic_count.hpp" #include "asio/detail/winrt_async_op.hpp" #include "asio/error.hpp" -#include "asio/io_context.hpp" +#include "asio/execution_context.hpp" + +#if defined(ASIO_HAS_IOCP) +# include "asio/detail/win_iocp_io_context.hpp" +#else // defined(ASIO_HAS_IOCP) +# include "asio/detail/scheduler.hpp" +#endif // defined(ASIO_HAS_IOCP) #include "asio/detail/push_options.hpp" @@ -31,13 +37,13 @@ namespace asio { namespace detail { class winrt_async_manager - : public asio::detail::service_base<winrt_async_manager> + : public execution_context_service_base<winrt_async_manager> { public: // Constructor. - winrt_async_manager(asio::io_context& io_context) - : asio::detail::service_base<winrt_async_manager>(io_context), - io_context_(use_service<io_context_impl>(io_context)), + winrt_async_manager(execution_context& context) + : execution_context_service_base<winrt_async_manager>(context), + scheduler_(use_service<scheduler_impl>(context)), outstanding_ops_(1) { } @@ -185,12 +191,12 @@ public: asio::system_category()); break; } - io_context_.post_deferred_completion(handler); + scheduler_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_context_.work_started(); + scheduler_.work_started(); ++outstanding_ops_; action->Completed = on_completed; } @@ -222,12 +228,12 @@ public: asio::system_category()); break; } - io_context_.post_deferred_completion(handler); + scheduler_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_context_.work_started(); + scheduler_.work_started(); ++outstanding_ops_; operation->Completed = on_completed; } @@ -263,19 +269,24 @@ public: asio::system_category()); break; } - io_context_.post_deferred_completion(handler); + scheduler_.post_deferred_completion(handler); if (--outstanding_ops_ == 0) promise_.set_value(); }); - io_context_.work_started(); + scheduler_.work_started(); ++outstanding_ops_; operation->Completed = on_completed; } private: - // The io_context implementation used to post completed handlers. - io_context_impl& io_context_; + // The scheduler implementation used to post completed handlers. +#if defined(ASIO_HAS_IOCP) + typedef class win_iocp_io_context scheduler_impl; +#else + typedef class scheduler scheduler_impl; +#endif + scheduler_impl& scheduler_; // Count of outstanding operations. atomic_count outstanding_ops_; |