handler_continuation_hook.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // handler_continuation_hook.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2024 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_HANDLER_CONTINUATION_HOOK_HPP
  11. #define BOOST_ASIO_HANDLER_CONTINUATION_HOOK_HPP
  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. #include <boost/asio/detail/push_options.hpp>
  17. namespace boost {
  18. namespace asio {
  19. /// Default continuation function for handlers.
  20. /**
  21. * Asynchronous operations may represent a continuation of the asynchronous
  22. * control flow associated with the current handler. The implementation can use
  23. * this knowledge to optimise scheduling of the handler.
  24. *
  25. * Implement asio_handler_is_continuation for your own handlers to indicate
  26. * when a handler represents a continuation.
  27. *
  28. * The default implementation of the continuation hook returns <tt>false</tt>.
  29. *
  30. * @par Example
  31. * @code
  32. * class my_handler;
  33. *
  34. * bool asio_handler_is_continuation(my_handler* context)
  35. * {
  36. * return true;
  37. * }
  38. * @endcode
  39. */
  40. inline bool asio_handler_is_continuation(...)
  41. {
  42. return false;
  43. }
  44. } // namespace asio
  45. } // namespace boost
  46. #include <boost/asio/detail/pop_options.hpp>
  47. #endif // BOOST_ASIO_HANDLER_CONTINUATION_HOOK_HPP