/
usr
/
include
/
boost
/
asio
/
impl
/
/usr/include/boost/asio/impl
mkdir
upload
Name
Size
Mode
Actions
awaitable.hpp
11748
0644
edit
dl
rm
buffered_read_stream.hpp
16925
0644
edit
dl
rm
buffered_write_stream.hpp
16429
0644
edit
dl
rm
compose.hpp
20461
0644
edit
dl
rm
connect.hpp
32234
0644
edit
dl
rm
co_spawn.hpp
8834
0644
edit
dl
rm
defer.hpp
7803
0644
edit
dl
rm
detached.hpp
3374
0644
edit
dl
rm
dispatch.hpp
7567
0644
edit
dl
rm
error.ipp
3070
0644
edit
dl
rm
execution_context.hpp
3247
0644
edit
dl
rm
execution_context.ipp
1801
0644
edit
dl
rm
executor.hpp
6835
0644
edit
dl
rm
executor.ipp
1002
0644
edit
dl
rm
handler_alloc_hook.ipp
1984
0644
edit
dl
rm
io_context.hpp
13728
0644
edit
dl
rm
io_context.ipp
4108
0644
edit
dl
rm
multiple_exceptions.ipp
1280
0644
edit
dl
rm
post.hpp
7762
0644
edit
dl
rm
read.hpp
45178
0644
edit
dl
rm
read_at.hpp
28331
0644
edit
dl
rm
read_until.hpp
115335
0644
edit
dl
rm
redirect_error.hpp
12015
0644
edit
dl
rm
serial_port_base.hpp
1375
0644
edit
dl
rm
serial_port_base.ipp
13327
0644
edit
dl
rm
spawn.hpp
15854
0644
edit
dl
rm
src.hpp
3833
0644
edit
dl
rm
system_context.hpp
875
0644
edit
dl
rm
system_context.ipp
2109
0644
edit
dl
rm
system_executor.hpp
6391
0644
edit
dl
rm
thread_pool.hpp
10853
0644
edit
dl
rm
thread_pool.ipp
3132
0644
edit
dl
rm
use_awaitable.hpp
7244
0644
edit
dl
rm
use_future.hpp
27610
0644
edit
dl
rm
write.hpp
41076
0644
edit
dl
rm
write_at.hpp
24732
0644
edit
dl
rm
Edit:
/usr/include/boost/asio/impl/use_awaitable.hpp
(7244B)
// // impl/use_awaitable.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // // Copyright (c) 2003-2020 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 BOOST_ASIO_IMPL_USE_AWAITABLE_HPP #define BOOST_ASIO_IMPL_USE_AWAITABLE_HPP #if defined(_MSC_VER) && (_MSC_VER >= 1200) # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> #include <boost/asio/async_result.hpp> #include <boost/asio/detail/push_options.hpp> namespace boost { namespace asio { namespace detail { template <typename Executor, typename T> class awaitable_handler_base : public awaitable_thread<Executor> { public: typedef void result_type; typedef awaitable<T, Executor> awaitable_type; // Construct from the entry point of a new thread of execution. awaitable_handler_base(awaitable<void, Executor> a, const Executor& ex) : awaitable_thread<Executor>(std::move(a), ex) { } // Transfer ownership from another awaitable_thread. explicit awaitable_handler_base(awaitable_thread<Executor>* h) : awaitable_thread<Executor>(std::move(*h)) { } protected: awaitable_frame<T, Executor>* frame() noexcept { return static_cast<awaitable_frame<T, Executor>*>(this->top_of_stack_); } }; template <typename, typename...> class awaitable_handler; template <typename Executor> class awaitable_handler<Executor> : public awaitable_handler_base<Executor, void> { public: using awaitable_handler_base<Executor, void>::awaitable_handler_base; void operator()() { this->frame()->attach_thread(this); this->frame()->return_void(); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor> class awaitable_handler<Executor, boost::system::error_code> : public awaitable_handler_base<Executor, void> { public: using awaitable_handler_base<Executor, void>::awaitable_handler_base; void operator()(const boost::system::error_code& ec) { this->frame()->attach_thread(this); if (ec) this->frame()->set_error(ec); else this->frame()->return_void(); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor> class awaitable_handler<Executor, std::exception_ptr> : public awaitable_handler_base<Executor, void> { public: using awaitable_handler_base<Executor, void>::awaitable_handler_base; void operator()(std::exception_ptr ex) { this->frame()->attach_thread(this); if (ex) this->frame()->set_except(ex); else this->frame()->return_void(); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename T> class awaitable_handler<Executor, T> : public awaitable_handler_base<Executor, T> { public: using awaitable_handler_base<Executor, T>::awaitable_handler_base; template <typename Arg> void operator()(Arg&& arg) { this->frame()->attach_thread(this); this->frame()->return_value(std::forward<Arg>(arg)); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename T> class awaitable_handler<Executor, boost::system::error_code, T> : public awaitable_handler_base<Executor, T> { public: using awaitable_handler_base<Executor, T>::awaitable_handler_base; template <typename Arg> void operator()(const boost::system::error_code& ec, Arg&& arg) { this->frame()->attach_thread(this); if (ec) this->frame()->set_error(ec); else this->frame()->return_value(std::forward<Arg>(arg)); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename T> class awaitable_handler<Executor, std::exception_ptr, T> : public awaitable_handler_base<Executor, T> { public: using awaitable_handler_base<Executor, T>::awaitable_handler_base; template <typename Arg> void operator()(std::exception_ptr ex, Arg&& arg) { this->frame()->attach_thread(this); if (ex) this->frame()->set_except(ex); else this->frame()->return_value(std::forward<Arg>(arg)); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename... Ts> class awaitable_handler : public awaitable_handler_base<Executor, std::tuple<Ts...>> { public: using awaitable_handler_base<Executor, std::tuple<Ts...>>::awaitable_handler_base; template <typename... Args> void operator()(Args&&... args) { this->frame()->attach_thread(this); this->frame()->return_values(std::forward<Args>(args)...); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename... Ts> class awaitable_handler<Executor, boost::system::error_code, Ts...> : public awaitable_handler_base<Executor, std::tuple<Ts...>> { public: using awaitable_handler_base<Executor, std::tuple<Ts...>>::awaitable_handler_base; template <typename... Args> void operator()(const boost::system::error_code& ec, Args&&... args) { this->frame()->attach_thread(this); if (ec) this->frame()->set_error(ec); else this->frame()->return_values(std::forward<Args>(args)...); this->frame()->pop_frame(); this->pump(); } }; template <typename Executor, typename... Ts> class awaitable_handler<Executor, std::exception_ptr, Ts...> : public awaitable_handler_base<Executor, std::tuple<Ts...>> { public: using awaitable_handler_base<Executor, std::tuple<Ts...>>::awaitable_handler_base; template <typename... Args> void operator()(std::exception_ptr ex, Args&&... args) { this->frame()->attach_thread(this); if (ex) this->frame()->set_except(ex); else this->frame()->return_values(std::forward<Args>(args)...); this->frame()->pop_frame(); this->pump(); } }; } // namespace detail #if !defined(GENERATING_DOCUMENTATION) template <typename Executor, typename R, typename... Args> class async_result<use_awaitable_t<Executor>, R(Args...)> { public: typedef typename detail::awaitable_handler< Executor, typename decay<Args>::type...> handler_type; typedef typename handler_type::awaitable_type return_type; #if defined(_MSC_VER) template <typename T> static T dummy_return() { return std::move(*static_cast<T*>(nullptr)); } template <> static void dummy_return() { } #endif // defined(_MSC_VER) template <typename Initiation, typename... InitArgs> static return_type initiate(Initiation initiation, use_awaitable_t<Executor> u, InitArgs... args) { (void)u; co_await [&](auto* frame) { BOOST_ASIO_HANDLER_LOCATION((u.file_name_, u.line_, u.function_name_)); handler_type handler(frame->detach_thread()); std::move(initiation)(std::move(handler), std::move(args)...); return static_cast<handler_type*>(nullptr); }; for (;;) {} // Never reached. #if defined(_MSC_VER) co_return dummy_return<typename return_type::value_type>(); #endif // defined(_MSC_VER) } }; #endif // !defined(GENERATING_DOCUMENTATION) } // namespace asio } // namespace boost #include <boost/asio/detail/pop_options.hpp> #endif // BOOST_ASIO_IMPL_USE_AWAITABLE_HPP
Save
cmd:
run