?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/adaptive_node_pool.hpp.tar
???????
usr/include/boost/container/detail/adaptive_node_pool.hpp 0000644 00000012701 15127535254 0017730 0 ustar 00 ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2013. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/container for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_HPP #define BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_HPP #ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> #endif #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/workaround.hpp> #include <boost/intrusive/set.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/container/detail/pool_common_alloc.hpp> #include <boost/container/detail/mutex.hpp> #include <boost/container/detail/adaptive_node_pool_impl.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/container/detail/type_traits.hpp> #include <cstddef> #include <cmath> #include <cassert> namespace boost { namespace container { namespace dtl { //!Pooled memory allocator using an smart adaptive pool. Includes //!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time. template< std::size_t NodeSize , std::size_t NodesPerBlock , std::size_t MaxFreeBlocks , std::size_t OverheadPercent > class private_adaptive_node_pool : public private_adaptive_node_pool_impl_ct < fake_segment_manager , MaxFreeBlocks , NodeSize , NodesPerBlock , OverheadPercent , unsigned(OverheadPercent == 0)*::boost::container::adaptive_pool_flag::align_only | ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered > { typedef private_adaptive_node_pool_impl_ct < fake_segment_manager , MaxFreeBlocks , NodeSize , NodesPerBlock , OverheadPercent , unsigned(OverheadPercent == 0)*::boost::container::adaptive_pool_flag::align_only | ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered > base_t; //Non-copyable private_adaptive_node_pool(const private_adaptive_node_pool &); private_adaptive_node_pool &operator=(const private_adaptive_node_pool &); public: static const std::size_t nodes_per_block = NodesPerBlock; //!Constructor. Never throws private_adaptive_node_pool() : base_t(0) {} }; //!Pooled memory allocator using adaptive pool. Includes //!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< std::size_t NodeSize , std::size_t NodesPerBlock , std::size_t MaxFreeBlocks , std::size_t OverheadPercent > class shared_adaptive_node_pool : public private_adaptive_node_pool <NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> { private: typedef private_adaptive_node_pool <NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> private_node_allocator_t; public: typedef typename private_node_allocator_t::multiallocation_chain multiallocation_chain; //!Constructor. Never throws shared_adaptive_node_pool() : private_node_allocator_t(){} //!Destructor. Deallocates all allocated blocks. Never throws ~shared_adaptive_node_pool() {} //!Allocates array of count elements. Can throw std::bad_alloc void *allocate_node() { //----------------------- scoped_lock<default_mutex> guard(mutex_); //----------------------- return private_node_allocator_t::allocate_node(); } //!Deallocates an array pointed by ptr. Never throws void deallocate_node(void *ptr) { //----------------------- scoped_lock<default_mutex> guard(mutex_); //----------------------- private_node_allocator_t::deallocate_node(ptr); } //!Allocates a singly linked list of n nodes ending in null pointer. //!can throw std::bad_alloc void allocate_nodes(const std::size_t n, multiallocation_chain &chain) { //----------------------- scoped_lock<default_mutex> guard(mutex_); //----------------------- return private_node_allocator_t::allocate_nodes(n, chain); } void deallocate_nodes(multiallocation_chain &chain) { //----------------------- scoped_lock<default_mutex> guard(mutex_); //----------------------- private_node_allocator_t::deallocate_nodes(chain); } //!Deallocates all the free blocks of memory. Never throws void deallocate_free_blocks() { //----------------------- scoped_lock<default_mutex> guard(mutex_); //----------------------- private_node_allocator_t::deallocate_free_blocks(); } private: default_mutex mutex_; }; } //namespace dtl { } //namespace container { } //namespace boost { #include <boost/container/detail/config_end.hpp> #endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_HPP usr/include/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 0000644 00000010133 15127726372 0022631 0 ustar 00 ////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // // See http://www.boost.org/libs/interprocess for documentation. // ////////////////////////////////////////////////////////////////////////////// #ifndef BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP #define BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP #ifndef BOOST_CONFIG_HPP # include <boost/config.hpp> #endif # #if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif #include <boost/interprocess/detail/config_begin.hpp> #include <boost/interprocess/detail/workaround.hpp> #include <boost/interprocess/detail/utilities.hpp> #include <boost/interprocess/detail/math_functions.hpp> #include <boost/intrusive/set.hpp> #include <boost/intrusive/slist.hpp> #include <boost/interprocess/detail/type_traits.hpp> #include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp> #include <boost/interprocess/allocators/detail/node_tools.hpp> #include <boost/interprocess/allocators/detail/allocator_common.hpp> #include <cstddef> #include <boost/config/no_tr1/cmath.hpp> #include <boost/container/detail/adaptive_node_pool_impl.hpp> #include <boost/assert.hpp> //!\file //!Describes the real adaptive pool shared by many Interprocess pool allocators namespace boost { namespace interprocess { namespace ipcdetail { template< class SegmentManager , std::size_t NodeSize , std::size_t NodesPerBlock , std::size_t MaxFreeBlocks , unsigned char OverheadPercent > class private_adaptive_node_pool : public boost::container::dtl::private_adaptive_node_pool_impl_rt < typename SegmentManager::segment_manager_base_type , ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered > { typedef boost::container::dtl::private_adaptive_node_pool_impl_rt < typename SegmentManager::segment_manager_base_type , ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered > base_t; //Non-copyable private_adaptive_node_pool(); private_adaptive_node_pool(const private_adaptive_node_pool &); private_adaptive_node_pool &operator=(const private_adaptive_node_pool &); public: typedef SegmentManager segment_manager; typedef typename base_t::size_type size_type; static const size_type nodes_per_block = NodesPerBlock; //!Constructor from a segment manager. Never throws private_adaptive_node_pool(segment_manager *segment_mngr) : base_t(segment_mngr, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent) {} //!Returns the segment manager. Never throws segment_manager* get_segment_manager() const { return static_cast<segment_manager*>(base_t::get_segment_manager_base()); } }; //!Pooled shared memory allocator using adaptive pool. Includes //!a reference count but the class does not delete itself, this is //!responsibility of user classes. Node size (NodeSize) and the number of //!nodes allocated per block (NodesPerBlock) are known at compile time template< class SegmentManager , std::size_t NodeSize , std::size_t NodesPerBlock , std::size_t MaxFreeBlocks , unsigned char OverheadPercent > class shared_adaptive_node_pool : public ipcdetail::shared_pool_impl < private_adaptive_node_pool <SegmentManager, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> > { typedef ipcdetail::shared_pool_impl < private_adaptive_node_pool <SegmentManager, NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> > base_t; public: shared_adaptive_node_pool(SegmentManager *segment_mgnr) : base_t(segment_mgnr) {} }; } //namespace ipcdetail { } //namespace interprocess { } //namespace boost { #include <boost/interprocess/detail/config_end.hpp> #endif //#ifndef BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????