32 #ifndef _GLIBCXX_PARALLEL_QUEUE_H 33 #define _GLIBCXX_PARALLEL_QUEUE_H 1 40 #define _GLIBCXX_VOLATILE volatile 51 template<
typename _Tp>
70 _M_max_size = __max_size;
71 _M_base =
new _Tp[__max_size];
85 _CASable __former_borders = _M_borders;
86 int __former_front, __former_back;
87 __decode2(__former_borders, __former_front, __former_back);
88 *(_M_base + __former_front % _M_max_size) = __t;
89 #if _GLIBCXX_PARALLEL_ASSERTIONS 91 _GLIBCXX_PARALLEL_ASSERT(((__former_front + 1) - __former_back)
102 int __former_front, __former_back;
104 __decode2(_M_borders, __former_front, __former_back);
105 while (__former_front > __former_back)
115 __t = *(_M_base + (__former_front - 1) % _M_max_size);
119 __decode2(_M_borders, __former_front, __former_back);
129 int __former_front, __former_back;
131 __decode2(_M_borders, __former_front, __former_back);
132 while (__former_front > __former_back)
142 __t = *(_M_base + __former_back % _M_max_size);
146 __decode2(_M_borders, __former_front, __former_back);
153 #undef _GLIBCXX_VOLATILE Basic types and typedefs. This file is a GNU parallel extension to the Standard C++ Library.
#define _GLIBCXX_VOLATILE
Decide whether to declare certain variable volatile in this file.
Double-ended queue of bounded size, allowing lock-free atomic access. push_front() and pop_front() mu...
_CASable __encode2(int __a, int __b)
Encode two integers into one gnu_parallel::_CASable.
int64_t _CASable
Longest compare-and-swappable integer type on this platform.
_RestrictedBoundedConcurrentQueue(_SequenceIndex __max_size)
Constructor. Not to be called concurrent, of course.
bool __compare_and_swap(volatile _Tp *__ptr, _Tp __comparand, _Tp __replacement)
Compare-and-swap.
_Tp __fetch_and_add(volatile _Tp *__ptr, _Tp __addend)
Add a value to a variable, atomically.
Sequential helper functions. This file is a GNU parallel extension to the Standard C++ Library.
bool pop_front(_Tp &__t)
Pops one element from the queue at the front end. Must not be called concurrently with pop_front().
GNU parallel code for public use.
Compatibility layer, mostly concerned with atomic operations.
~_RestrictedBoundedConcurrentQueue()
Destructor. Not to be called concurrent, of course.
void __decode2(_CASable __x, int &__a, int &__b)
Decode two integers from one gnu_parallel::_CASable.
void push_front(const _Tp &__t)
Pushes one element into the queue at the front end. Must not be called concurrently with pop_front().
bool pop_back(_Tp &__t)
Pops one element from the queue at the front end. Must not be called concurrently with pop_front().
uint64_t _SequenceIndex
Unsigned integer to index __elements. The total number of elements for each algorithm must fit into t...