annotate DEPENDENCIES/generic/include/boost/asio/handler_alloc_hook.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents c530137014c0
children
rev   line source
Chris@16 1 //
Chris@16 2 // handler_alloc_hook.hpp
Chris@16 3 // ~~~~~~~~~~~~~~~~~~~~~~
Chris@16 4 //
Chris@101 5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
Chris@16 6 //
Chris@16 7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10
Chris@16 11 #ifndef BOOST_ASIO_HANDLER_ALLOC_HOOK_HPP
Chris@16 12 #define BOOST_ASIO_HANDLER_ALLOC_HOOK_HPP
Chris@16 13
Chris@16 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 15 # pragma once
Chris@16 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
Chris@16 17
Chris@16 18 #include <boost/asio/detail/config.hpp>
Chris@16 19 #include <cstddef>
Chris@16 20
Chris@16 21 #include <boost/asio/detail/push_options.hpp>
Chris@16 22
Chris@16 23 namespace boost {
Chris@16 24 namespace asio {
Chris@16 25
Chris@16 26 /// Default allocation function for handlers.
Chris@16 27 /**
Chris@16 28 * Asynchronous operations may need to allocate temporary objects. Since
Chris@16 29 * asynchronous operations have a handler function object, these temporary
Chris@16 30 * objects can be said to be associated with the handler.
Chris@16 31 *
Chris@16 32 * Implement asio_handler_allocate and asio_handler_deallocate for your own
Chris@16 33 * handlers to provide custom allocation for these temporary objects.
Chris@16 34 *
Chris@16 35 * The default implementation of these allocation hooks uses <tt>::operator
Chris@16 36 * new</tt> and <tt>::operator delete</tt>.
Chris@16 37 *
Chris@16 38 * @note All temporary objects associated with a handler will be deallocated
Chris@16 39 * before the upcall to the handler is performed. This allows the same memory to
Chris@16 40 * be reused for a subsequent asynchronous operation initiated by the handler.
Chris@16 41 *
Chris@16 42 * @par Example
Chris@16 43 * @code
Chris@16 44 * class my_handler;
Chris@16 45 *
Chris@16 46 * void* asio_handler_allocate(std::size_t size, my_handler* context)
Chris@16 47 * {
Chris@16 48 * return ::operator new(size);
Chris@16 49 * }
Chris@16 50 *
Chris@16 51 * void asio_handler_deallocate(void* pointer, std::size_t size,
Chris@16 52 * my_handler* context)
Chris@16 53 * {
Chris@16 54 * ::operator delete(pointer);
Chris@16 55 * }
Chris@16 56 * @endcode
Chris@16 57 */
Chris@16 58 BOOST_ASIO_DECL void* asio_handler_allocate(
Chris@16 59 std::size_t size, ...);
Chris@16 60
Chris@16 61 /// Default deallocation function for handlers.
Chris@16 62 /**
Chris@16 63 * Implement asio_handler_allocate and asio_handler_deallocate for your own
Chris@16 64 * handlers to provide custom allocation for the associated temporary objects.
Chris@16 65 *
Chris@16 66 * The default implementation of these allocation hooks uses <tt>::operator
Chris@16 67 * new</tt> and <tt>::operator delete</tt>.
Chris@16 68 *
Chris@16 69 * @sa asio_handler_allocate.
Chris@16 70 */
Chris@16 71 BOOST_ASIO_DECL void asio_handler_deallocate(
Chris@16 72 void* pointer, std::size_t size, ...);
Chris@16 73
Chris@16 74 } // namespace asio
Chris@16 75 } // namespace boost
Chris@16 76
Chris@16 77 #include <boost/asio/detail/pop_options.hpp>
Chris@16 78
Chris@16 79 #if defined(BOOST_ASIO_HEADER_ONLY)
Chris@16 80 # include <boost/asio/impl/handler_alloc_hook.ipp>
Chris@16 81 #endif // defined(BOOST_ASIO_HEADER_ONLY)
Chris@16 82
Chris@16 83 #endif // BOOST_ASIO_HANDLER_ALLOC_HOOK_HPP