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