]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/asio/impl/handler_alloc_hook.ipp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / asio / impl / handler_alloc_hook.ipp
1 //
2 // impl/handler_alloc_hook.ipp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2022 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_IMPL_HANDLER_ALLOC_HOOK_IPP
12 #define BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP
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 #include <boost/asio/detail/memory.hpp>
20 #include <boost/asio/detail/thread_context.hpp>
21 #include <boost/asio/detail/thread_info_base.hpp>
22 #include <boost/asio/handler_alloc_hook.hpp>
23
24 #include <boost/asio/detail/push_options.hpp>
25
26 namespace boost {
27 namespace asio {
28
29 asio_handler_allocate_is_deprecated
30 asio_handler_allocate(std::size_t size, ...)
31 {
32 #if defined(BOOST_ASIO_NO_DEPRECATED)
33 (void)size;
34 return asio_handler_allocate_is_no_longer_used();
35 #elif !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
36 return detail::thread_info_base::allocate(
37 detail::thread_context::top_of_thread_call_stack(), size);
38 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
39 return aligned_new(BOOST_ASIO_DEFAULT_ALIGN, size);
40 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
41 }
42
43 asio_handler_deallocate_is_deprecated
44 asio_handler_deallocate(void* pointer, std::size_t size, ...)
45 {
46 #if defined(BOOST_ASIO_NO_DEPRECATED)
47 (void)pointer;
48 (void)size;
49 return asio_handler_deallocate_is_no_longer_used();
50 #elif !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
51 detail::thread_info_base::deallocate(
52 detail::thread_context::top_of_thread_call_stack(), pointer, size);
53 #else // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
54 (void)size;
55 aligned_delete(pointer)
56 #endif // !defined(BOOST_ASIO_DISABLE_SMALL_BLOCK_RECYCLING)
57 }
58
59 } // namespace asio
60 } // namespace boost
61
62 #include <boost/asio/detail/pop_options.hpp>
63
64 #endif // BOOST_ASIO_IMPL_HANDLER_ALLOC_HOOK_IPP