Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-16 08:37:46

0001 // boost lockfree
0002 //
0003 // Copyright (C) 2011 Tim Blechmann
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. (See
0006 // accompanying file LICENSE_1_0.txt or copy at
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 
0009 #ifndef BOOST_LOCKFREE_POLICIES_HPP_INCLUDED
0010 #define BOOST_LOCKFREE_POLICIES_HPP_INCLUDED
0011 
0012 #include <boost/config.hpp>
0013 #ifdef BOOST_HAS_PRAGMA_ONCE
0014 #    pragma once
0015 #endif
0016 
0017 #include <boost/parameter/template_keyword.hpp>
0018 
0019 #include <type_traits>
0020 
0021 namespace boost { namespace lockfree {
0022 
0023 #ifndef BOOST_DOXYGEN_INVOKED
0024 namespace tag {
0025 struct allocator;
0026 struct fixed_sized;
0027 struct capacity;
0028 struct allow_multiple_reads;
0029 } // namespace tag
0030 
0031 template < bool IsFixedSized >
0032 struct fixed_sized : boost::parameter::template_keyword< tag::fixed_sized, std::integral_constant< bool, IsFixedSized > >
0033 {};
0034 
0035 template < size_t Size >
0036 struct capacity : boost::parameter::template_keyword< tag::capacity, std::integral_constant< size_t, Size > >
0037 {};
0038 
0039 template < class Alloc >
0040 struct allocator : boost::parameter::template_keyword< tag::allocator, Alloc >
0041 {};
0042 
0043 template < bool AllowMultipleReads >
0044 struct allow_multiple_reads :
0045     boost::parameter::template_keyword< tag::allow_multiple_reads, std::integral_constant< bool, AllowMultipleReads > >
0046 {};
0047 
0048 #else
0049 
0050 /** Configures a data structure as \b fixed-sized.
0051  *
0052  *  The internal nodes are stored inside an array and they are addressed by array indexing. This limits the possible
0053  * size of the queue to the number of elements that can be addressed by the index type (usually 2**16-2), but on
0054  * platforms that lack double-width compare-and-exchange instructions, this is the best way to achieve lock-freedom.
0055  * This implies that a data structure is bounded.
0056  * */
0057 template < bool IsFixedSized >
0058 struct fixed_sized;
0059 
0060 /** Sets the \b capacity of a data structure at compile-time.
0061  *
0062  * This implies that a data structure is bounded and fixed-sized.
0063  * */
0064 template < size_t Size >
0065 struct capacity;
0066 
0067 /** Defines the \b allocator type of a data structure.
0068  * */
0069 template < class Alloc >
0070 struct allocator;
0071 
0072 /** Configures the spsc_value to consume the value multiple times
0073  *
0074  * Caveats:
0075  * * one cannot move the value out
0076  * */
0077 template < bool AllowMultipleReads >
0078 struct allow_multiple_reads;
0079 
0080 #endif
0081 
0082 }}     // namespace boost::lockfree
0083 
0084 #endif /* BOOST_LOCKFREE_POLICIES_HPP_INCLUDED */