annotate DEPENDENCIES/generic/include/boost/asio/impl/handler_alloc_hook.ipp @ 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 // impl/handler_alloc_hook.ipp
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_IMPL_HANDLER_ALLOC_HOOK_IPP
Chris@16 12 #define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
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 <boost/asio/detail/call_stack.hpp>
Chris@16 20 #include <boost/asio/handler_alloc_hook.hpp>
Chris@16 21
Chris@16 22 #if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 23 # if defined(BOOST_ASIO_HAS_IOCP)
Chris@16 24 # include <boost/asio/detail/win_iocp_thread_info.hpp>
Chris@16 25 # else // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 26 # include <boost/asio/detail/task_io_service_thread_info.hpp>
Chris@16 27 # endif // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 28 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 29
Chris@16 30 #include <boost/asio/detail/push_options.hpp>
Chris@16 31
Chris@16 32 namespace boost {
Chris@16 33 namespace asio {
Chris@16 34
Chris@16 35 #if defined(BOOST_ASIO_HAS_IOCP)
Chris@16 36 namespace detail { class win_iocp_io_service; }
Chris@16 37 #endif // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 38
Chris@16 39 void* asio_handler_allocate(std::size_t size, ...)
Chris@16 40 {
Chris@16 41 #if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 42 # if defined(BOOST_ASIO_HAS_IOCP)
Chris@16 43 typedef detail::win_iocp_io_service io_service_impl;
Chris@16 44 typedef detail::win_iocp_thread_info thread_info;
Chris@16 45 # else // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 46 typedef detail::task_io_service io_service_impl;
Chris@16 47 typedef detail::task_io_service_thread_info thread_info;
Chris@16 48 # endif // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 49 typedef detail::call_stack<io_service_impl, thread_info> call_stack;
Chris@16 50 return thread_info::allocate(call_stack::top(), size);
Chris@16 51 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 52 return ::operator new(size);
Chris@16 53 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 54 }
Chris@16 55
Chris@16 56 void asio_handler_deallocate(void* pointer, std::size_t size, ...)
Chris@16 57 {
Chris@16 58 #if !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 59 # if defined(BOOST_ASIO_HAS_IOCP)
Chris@16 60 typedef detail::win_iocp_io_service io_service_impl;
Chris@16 61 typedef detail::win_iocp_thread_info thread_info;
Chris@16 62 # else // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 63 typedef detail::task_io_service io_service_impl;
Chris@16 64 typedef detail::task_io_service_thread_info thread_info;
Chris@16 65 # endif // defined(BOOST_ASIO_HAS_IOCP)
Chris@16 66 typedef detail::call_stack<io_service_impl, thread_info> call_stack;
Chris@16 67 thread_info::deallocate(call_stack::top(), pointer, size);
Chris@16 68 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 69 (void)size;
Chris@16 70 ::operator delete(pointer);
Chris@16 71 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
Chris@16 72 }
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 #endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP