summaryrefslogtreecommitdiff
path: root/boost/asio/detail/winrt_async_manager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/asio/detail/winrt_async_manager.hpp')
-rw-r--r--boost/asio/detail/winrt_async_manager.hpp39
1 files changed, 25 insertions, 14 deletions
diff --git a/boost/asio/detail/winrt_async_manager.hpp b/boost/asio/detail/winrt_async_manager.hpp
index 57d6a1c218..e9dc6cb257 100644
--- a/boost/asio/detail/winrt_async_manager.hpp
+++ b/boost/asio/detail/winrt_async_manager.hpp
@@ -2,7 +2,7 @@
// detail/winrt_async_manager.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
-// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
+// Copyright (c) 2003-2019 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 <boost/asio/detail/atomic_count.hpp>
#include <boost/asio/detail/winrt_async_op.hpp>
#include <boost/asio/error.hpp>
-#include <boost/asio/io_context.hpp>
+#include <boost/asio/execution_context.hpp>
+
+#if defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/win_iocp_io_context.hpp>
+#else // defined(BOOST_ASIO_HAS_IOCP)
+# include <boost/asio/detail/scheduler.hpp>
+#endif // defined(BOOST_ASIO_HAS_IOCP)
#include <boost/asio/detail/push_options.hpp>
@@ -32,13 +38,13 @@ namespace asio {
namespace detail {
class winrt_async_manager
- : public boost::asio::detail::service_base<winrt_async_manager>
+ : public execution_context_service_base<winrt_async_manager>
{
public:
// Constructor.
- winrt_async_manager(boost::asio::io_context& io_context)
- : boost::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)
{
}
@@ -186,12 +192,12 @@ public:
boost::system::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;
}
@@ -223,12 +229,12 @@ public:
boost::system::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;
}
@@ -264,19 +270,24 @@ public:
boost::system::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(BOOST_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_;