awaitable.ipp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //
  2. // impl/awaitable.ipp
  3. // ~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2025 Christopher M. Kohlhoff (chris at kohlhoff dot com)
  6. //
  7. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  8. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  9. //
  10. #ifndef BOOST_ASIO_IMPL_AWAITABLE_IPP
  11. #define BOOST_ASIO_IMPL_AWAITABLE_IPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/config.hpp>
  16. #if defined(BOOST_ASIO_HAS_CO_AWAIT)
  17. #include <boost/asio/awaitable.hpp>
  18. #include <boost/asio/detail/call_stack.hpp>
  19. #include <boost/asio/detail/push_options.hpp>
  20. namespace boost {
  21. namespace asio {
  22. namespace detail {
  23. void awaitable_launch_context::launch(void (*pump_fn)(void*), void* arg)
  24. {
  25. call_stack<awaitable_launch_context>::context ctx(this);
  26. pump_fn(arg);
  27. }
  28. bool awaitable_launch_context::is_launching()
  29. {
  30. return !!call_stack<awaitable_launch_context>::contains(this);
  31. }
  32. } // namespace detail
  33. } // namespace asio
  34. } // namespace boost
  35. #include <boost/asio/detail/pop_options.hpp>
  36. #endif // defined(BOOST_ASIO_HAS_CO_AWAIT)
  37. #endif // BOOST_ASIO_IMPL_AWAITABLE_IPP