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 | |
11 | #ifndef BOOST_ASIO_HANDLER_CONTINUATION_HOOK_HPP |
12 | #define BOOST_ASIO_HANDLER_CONTINUATION_HOOK_HPP |
13 | |
14 | #if defined(_MSC_VER) && (_MSC_VER >= 1200) |
15 | # pragma once |
16 | #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) |
17 | |
18 | #include <boost/asio/detail/config.hpp> |
19 | |
20 | #include <boost/asio/detail/push_options.hpp> |
21 | |
22 | namespace boost { |
23 | namespace asio { |
24 | |
25 | /// Default continuation function for handlers. |
26 | /** |
27 | * Asynchronous operations may represent a continuation of the asynchronous |
28 | * control flow associated with the current handler. The implementation can use |
29 | * this knowledge to optimise scheduling of the handler. |
30 | * |
31 | * Implement asio_handler_is_continuation for your own handlers to indicate |
32 | * when a handler represents a continuation. |
33 | * |
34 | * The default implementation of the continuation hook returns <tt>false</tt>. |
35 | * |
36 | * @par Example |
37 | * @code |
38 | * class my_handler; |
39 | * |
40 | * bool asio_handler_is_continuation(my_handler* context) |
41 | * { |
42 | * return true; |
43 | * } |
44 | * @endcode |
45 | */ |
46 | inline bool asio_handler_is_continuation(...) |
47 | { |
48 | return false; |
49 | } |
50 | |
51 | } // namespace asio |
52 | } // namespace boost |
53 | |
54 | #include <boost/asio/detail/pop_options.hpp> |
55 | |
56 | #endif // BOOST_ASIO_HANDLER_CONTINUATION_HOOK_HPP |
57 | |