concurrent_queue.h
Go to the documentation of this file.
/*
Copyright (c) 2005-2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef __TBB_concurrent_queue_H
#define __TBB_concurrent_queue_H
#define __TBB_concurrent_queue_H_include_area
#include "internal/_warning_suppress_enable_notice.h"
#include "internal/_concurrent_queue_impl.h"
#include "internal/_allocator_traits.h"
namespace tbb {
namespace strict_ppl {
template<typename T, typename A = cache_aligned_allocator<T> >
class concurrent_queue: public internal::concurrent_queue_base_v3<T> {
template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
typedef typename tbb::internal::allocator_rebind<A, char>::type page_allocator_type;
page_allocator_type my_allocator;
virtual void *allocate_block( size_t n ) __TBB_override {
void *b = reinterpret_cast<void*>(my_allocator.allocate( n ));
if( !b )
internal::throw_exception(internal::eid_bad_alloc);
return b;
}
virtual void deallocate_block( void *b, size_t n ) __TBB_override {
my_allocator.deallocate( reinterpret_cast<char*>(b), n );
}
static void copy_construct_item(T* location, const void* src){
new (location) T(*static_cast<const T*>(src));
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
static void move_construct_item(T* location, const void* src) {
new (location) T( std::move(*static_cast<T*>(const_cast<void*>(src))) );
}
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
public:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef A allocator_type;
explicit concurrent_queue(const allocator_type& a = allocator_type()) :
my_allocator( a )
{
}
template<typename InputIterator>
concurrent_queue( InputIterator begin, InputIterator end, const allocator_type& a = allocator_type()) :
my_allocator( a )
{
for( ; begin != end; ++begin )
this->push(*begin);
}
concurrent_queue( const concurrent_queue& src, const allocator_type& a = allocator_type()) :
internal::concurrent_queue_base_v3<T>(), my_allocator( a )
{
this->assign( src, copy_construct_item );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
concurrent_queue( concurrent_queue&& src ) :
internal::concurrent_queue_base_v3<T>(), my_allocator( std::move(src.my_allocator) )
{
this->internal_swap( src );
}
concurrent_queue( concurrent_queue&& src, const allocator_type& a ) :
internal::concurrent_queue_base_v3<T>(), my_allocator( a )
{
// checking that memory allocated by one instance of allocator can be deallocated
// with another
if( my_allocator == src.my_allocator) {
this->internal_swap( src );
} else {
// allocators are different => performing per-element move
this->assign( src, move_construct_item );
src.clear();
}
}
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
~concurrent_queue();
void push( const T& source ) {
this->internal_push( &source, copy_construct_item );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
void push( T&& source ) {
this->internal_push( &source, move_construct_item );
}
#if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
template<typename... Arguments>
void emplace( Arguments&&... args ) {
push( T(std::forward<Arguments>( args )...) );
}
#endif //__TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
bool try_pop( T& result ) {
return this->internal_try_pop( &result );
}
size_type unsafe_size() const {return this->internal_size();}
bool empty() const {return this->internal_empty();}
void clear() ;
allocator_type get_allocator() const { return this->my_allocator; }
typedef internal::concurrent_queue_iterator<concurrent_queue,T> iterator;
typedef internal::concurrent_queue_iterator<concurrent_queue,const T> const_iterator;
//------------------------------------------------------------------------
// The iterators are intended only for debugging. They are slow and not thread safe.
//------------------------------------------------------------------------
iterator unsafe_begin() {return iterator(*this);}
iterator unsafe_end() {return iterator();}
const_iterator unsafe_begin() const {return const_iterator(*this);}
const_iterator unsafe_end() const {return const_iterator();}
} ;
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
// Deduction guide for the constructor from two iterators
template<typename InputIterator,
typename T = typename std::iterator_traits<InputIterator>::value_type,
typename A = cache_aligned_allocator<T>
> concurrent_queue(InputIterator, InputIterator, const A& = A())
-> concurrent_queue<T, A>;
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
template<typename T, class A>
concurrent_queue<T,A>::~concurrent_queue() {
clear();
this->internal_finish_clear();
}
template<typename T, class A>
void concurrent_queue<T,A>::clear() {
T value;
while( !empty() ) try_pop(value);
}
} // namespace strict_ppl
template<typename T, class A = cache_aligned_allocator<T> >
class concurrent_bounded_queue: public internal::concurrent_queue_base_v8 {
template<typename Container, typename Value> friend class internal::concurrent_queue_iterator;
typedef typename tbb::internal::allocator_rebind<A, char>::type page_allocator_type;
page_allocator_type my_allocator;
typedef typename concurrent_queue_base_v3::padded_page<T> padded_page;
typedef typename concurrent_queue_base_v3::copy_specifics copy_specifics;
class destroyer: internal::no_copy {
T& my_value;
public:
destroyer( T& value ) : my_value(value) {}
~destroyer() {my_value.~T();}
};
T& get_ref( page& p, size_t index ) {
__TBB_ASSERT( index<items_per_page, NULL );
return (&static_cast<padded_page*>(static_cast<void*>(&p))->last)[index];
}
virtual void copy_item( page& dst, size_t index, const void* src ) __TBB_override {
new( &get_ref(dst,index) ) T(*static_cast<const T*>(src));
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
virtual void move_item( page& dst, size_t index, const void* src ) __TBB_override {
new( &get_ref(dst,index) ) T( std::move(*static_cast<T*>(const_cast<void*>(src))) );
}
#else
virtual void move_item( page&, size_t, const void* ) __TBB_override {
__TBB_ASSERT( false, "Unreachable code" );
}
#endif
virtual void copy_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) __TBB_override {
new( &get_ref(dst,dindex) ) T( get_ref( const_cast<page&>(src), sindex ) );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
virtual void move_page_item( page& dst, size_t dindex, const page& src, size_t sindex ) __TBB_override {
new( &get_ref(dst,dindex) ) T( std::move(get_ref( const_cast<page&>(src), sindex )) );
}
#else
virtual void move_page_item( page&, size_t, const page&, size_t ) __TBB_override {
__TBB_ASSERT( false, "Unreachable code" );
}
#endif
virtual void assign_and_destroy_item( void* dst, page& src, size_t index ) __TBB_override {
T& from = get_ref(src,index);
destroyer d(from);
*static_cast<T*>(dst) = tbb::internal::move( from );
}
virtual page *allocate_page() __TBB_override {
size_t n = sizeof(padded_page) + (items_per_page-1)*sizeof(T);
page *p = reinterpret_cast<page*>(my_allocator.allocate( n ));
if( !p )
internal::throw_exception(internal::eid_bad_alloc);
return p;
}
virtual void deallocate_page( page *p ) __TBB_override {
size_t n = sizeof(padded_page) + (items_per_page-1)*sizeof(T);
my_allocator.deallocate( reinterpret_cast<char*>(p), n );
}
public:
typedef T value_type;
typedef A allocator_type;
typedef T& reference;
typedef const T& const_reference;
typedef std::ptrdiff_t size_type;
typedef std::ptrdiff_t difference_type;
explicit concurrent_bounded_queue(const allocator_type& a = allocator_type()) :
concurrent_queue_base_v8( sizeof(T) ), my_allocator( a )
{
}
concurrent_bounded_queue( const concurrent_bounded_queue& src, const allocator_type& a = allocator_type())
: concurrent_queue_base_v8( sizeof(T) ), my_allocator( a )
{
assign( src );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
concurrent_bounded_queue( concurrent_bounded_queue&& src )
: concurrent_queue_base_v8( sizeof(T) ), my_allocator( std::move(src.my_allocator) )
{
internal_swap( src );
}
concurrent_bounded_queue( concurrent_bounded_queue&& src, const allocator_type& a )
: concurrent_queue_base_v8( sizeof(T) ), my_allocator( a )
{
// checking that memory allocated by one instance of allocator can be deallocated
// with another
if( my_allocator == src.my_allocator) {
this->internal_swap( src );
} else {
// allocators are different => performing per-element move
this->move_content( src );
src.clear();
}
}
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
template<typename InputIterator>
concurrent_bounded_queue( InputIterator begin, InputIterator end,
const allocator_type& a = allocator_type())
: concurrent_queue_base_v8( sizeof(T) ), my_allocator( a )
{
for( ; begin != end; ++begin )
internal_push_if_not_full(&*begin);
}
~concurrent_bounded_queue();
void push( const T& source ) {
internal_push( &source );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
void push( T&& source ) {
internal_push_move( &source );
}
#if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
template<typename... Arguments>
void emplace( Arguments&&... args ) {
push( T(std::forward<Arguments>( args )...) );
}
#endif /* __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT */
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
void pop( T& destination ) {
internal_pop( &destination );
}
#if TBB_USE_EXCEPTIONS
void abort() {
internal_abort();
}
#endif
bool try_push( const T& source ) {
return internal_push_if_not_full( &source );
}
#if __TBB_CPP11_RVALUE_REF_PRESENT
bool try_push( T&& source ) {
return internal_push_move_if_not_full( &source );
}
#if __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT
template<typename... Arguments>
bool try_emplace( Arguments&&... args ) {
return try_push( T(std::forward<Arguments>( args )...) );
}
#endif /* __TBB_CPP11_VARIADIC_TEMPLATES_PRESENT */
#endif /* __TBB_CPP11_RVALUE_REF_PRESENT */
bool try_pop( T& destination ) {
return internal_pop_if_present( &destination );
}
size_type size() const {return internal_size();}
bool empty() const {return internal_empty();}
size_type capacity() const {
return my_capacity;
}
void set_capacity( size_type new_capacity ) {
internal_set_capacity( new_capacity, sizeof(T) );
}
allocator_type get_allocator() const { return this->my_allocator; }
void clear() ;
typedef internal::concurrent_queue_iterator<concurrent_bounded_queue,T> iterator;
typedef internal::concurrent_queue_iterator<concurrent_bounded_queue,const T> const_iterator;
//------------------------------------------------------------------------
// The iterators are intended only for debugging. They are slow and not thread safe.
//------------------------------------------------------------------------
iterator unsafe_begin() {return iterator(*this);}
iterator unsafe_end() {return iterator();}
const_iterator unsafe_begin() const {return const_iterator(*this);}
const_iterator unsafe_end() const {return const_iterator();}
};
#if __TBB_CPP17_DEDUCTION_GUIDES_PRESENT
// guide for concurrent_bounded_queue(InputIterator, InputIterator, ...)
template<typename InputIterator,
typename T = typename std::iterator_traits<InputIterator>::value_type,
typename A = cache_aligned_allocator<T>
> concurrent_bounded_queue(InputIterator, InputIterator, const A& = A())
-> concurrent_bounded_queue<T, A>;
#endif /* __TBB_CPP17_DEDUCTION_GUIDES_PRESENT */
template<typename T, class A>
concurrent_bounded_queue<T,A>::~concurrent_bounded_queue() {
clear();
internal_finish_clear();
}
template<typename T, class A>
void concurrent_bounded_queue<T,A>::clear() {
T value;
while( try_pop(value) ) /*noop*/;
}
using strict_ppl::concurrent_queue;
} // namespace tbb
#include "internal/_warning_suppress_disable_notice.h"
#undef __TBB_concurrent_queue_H_include_area
#endif /* __TBB_concurrent_queue_H */
_allocator_traits.h
_concurrent_queue_impl.h
_warning_suppress_disable_notice.h
_warning_suppress_enable_notice.h
__TBB_ASSERT
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
__TBB_override
#define __TBB_override
Definition: tbb_stddef.h:240
end
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp end
Definition: ittnotify_static.h:182
begin
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp begin
Definition: ittnotify_static.h:182
d
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d
Definition: ittnotify_static.h:109
value
void const char const char int ITT_FORMAT __itt_group_sync x void const char ITT_FORMAT __itt_group_sync s void ITT_FORMAT __itt_group_sync p void ITT_FORMAT p void ITT_FORMAT p no args __itt_suppress_mode_t unsigned int void size_t ITT_FORMAT d void ITT_FORMAT p void ITT_FORMAT p __itt_model_site __itt_model_site_instance ITT_FORMAT p __itt_model_task __itt_model_task_instance ITT_FORMAT p void ITT_FORMAT p void ITT_FORMAT p void size_t ITT_FORMAT d void ITT_FORMAT p const wchar_t ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s const char ITT_FORMAT s no args void ITT_FORMAT p size_t ITT_FORMAT d no args const wchar_t const wchar_t ITT_FORMAT s __itt_heap_function void size_t int ITT_FORMAT d __itt_heap_function void ITT_FORMAT p __itt_heap_function void void size_t int ITT_FORMAT d no args no args unsigned int ITT_FORMAT u const __itt_domain __itt_id ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain __itt_id ITT_FORMAT p const __itt_domain __itt_id __itt_timestamp __itt_timestamp ITT_FORMAT lu const __itt_domain __itt_id __itt_id __itt_string_handle ITT_FORMAT p const __itt_domain ITT_FORMAT p const __itt_domain __itt_string_handle unsigned long long value
Definition: ittnotify_static.h:192
p
void const char const char int ITT_FORMAT __itt_group_sync p
Definition: ittnotify_static.h:91
tbb
The graph class.
Definition: serial/tbb/parallel_for.h:46
tbb::move
void move(tbb_thread &t1, tbb_thread &t2)
Definition: tbb_thread.h:319
tbb::internal::throw_exception
void throw_exception(exception_id eid)
Versionless convenience wrapper for throw_exception_v4()
Definition: tbb_exception.h:105
tbb::internal::last
auto last(Container &c) -> decltype(begin(c))
Definition: _range_iterator.h:40
tbb::internal::eid_bad_alloc
@ eid_bad_alloc
Definition: tbb_exception.h:68
internal
Definition: _flow_graph_async_msg_impl.h:24
tbb::cache_aligned_allocator
Meets "allocator" requirements of ISO C++ Standard, Section 20.1.5.
Definition: cache_aligned_allocator.h:60
tbb::strict_ppl::concurrent_queue
A high-performance thread-safe non-blocking concurrent queue.
Definition: concurrent_queue.h:35
tbb::strict_ppl::concurrent_queue::move_construct_item
static void move_construct_item(T *location, const void *src)
Definition: concurrent_queue.h:60
tbb::strict_ppl::concurrent_queue::concurrent_queue
concurrent_queue(concurrent_queue &&src, const allocator_type &a)
Definition: concurrent_queue.h:113
tbb::strict_ppl::concurrent_queue::unsafe_end
const_iterator unsafe_end() const
Definition: concurrent_queue.h:177
tbb::strict_ppl::concurrent_queue::unsafe_size
size_type unsafe_size() const
Return the number of items in the queue; thread unsafe.
Definition: concurrent_queue.h:157
tbb::strict_ppl::concurrent_queue::push
void push(T &&source)
Definition: concurrent_queue.h:137
tbb::strict_ppl::concurrent_queue::copy_construct_item
static void copy_construct_item(T *location, const void *src)
Definition: concurrent_queue.h:55
tbb::strict_ppl::concurrent_queue::concurrent_queue
concurrent_queue(InputIterator begin, InputIterator end, const allocator_type &a=allocator_type())
[begin,end) constructor
Definition: concurrent_queue.h:91
tbb::strict_ppl::concurrent_queue::allocate_block
virtual void * allocate_block(size_t n) __TBB_override
Allocates a block of size n (bytes)
Definition: concurrent_queue.h:43
tbb::strict_ppl::concurrent_queue::const_reference
const T & const_reference
Const reference type.
Definition: concurrent_queue.h:72
tbb::strict_ppl::concurrent_queue::concurrent_queue
concurrent_queue(const allocator_type &a=allocator_type())
Construct empty queue.
Definition: concurrent_queue.h:84
tbb::strict_ppl::concurrent_queue::deallocate_block
virtual void deallocate_block(void *b, size_t n) __TBB_override
Deallocates block created by allocate_block.
Definition: concurrent_queue.h:51
tbb::strict_ppl::concurrent_queue::difference_type
ptrdiff_t difference_type
Difference type for iterator.
Definition: concurrent_queue.h:78
tbb::strict_ppl::concurrent_queue::unsafe_begin
iterator unsafe_begin()
Definition: concurrent_queue.h:174
tbb::strict_ppl::concurrent_queue::const_iterator
internal::concurrent_queue_iterator< concurrent_queue, const T > const_iterator
Definition: concurrent_queue.h:169
tbb::strict_ppl::concurrent_queue::emplace
void emplace(Arguments &&... args)
Definition: concurrent_queue.h:143
tbb::strict_ppl::concurrent_queue::push
void push(const T &source)
Enqueue an item at tail of queue.
Definition: concurrent_queue.h:132
tbb::strict_ppl::concurrent_queue::size_type
size_t size_type
Integral type for representing size of the queue.
Definition: concurrent_queue.h:75
tbb::strict_ppl::concurrent_queue::~concurrent_queue
~concurrent_queue()
Destroy queue.
Definition: concurrent_queue.h:190
tbb::strict_ppl::concurrent_queue::unsafe_end
iterator unsafe_end()
Definition: concurrent_queue.h:175
tbb::strict_ppl::concurrent_queue::try_pop
bool try_pop(T &result)
Attempt to dequeue an item from head of queue.
Definition: concurrent_queue.h:152
tbb::strict_ppl::concurrent_queue::iterator
internal::concurrent_queue_iterator< concurrent_queue, T > iterator
Definition: concurrent_queue.h:168
tbb::strict_ppl::concurrent_queue::reference
T & reference
Reference type.
Definition: concurrent_queue.h:69
tbb::strict_ppl::concurrent_queue::unsafe_begin
const_iterator unsafe_begin() const
Definition: concurrent_queue.h:176
tbb::strict_ppl::concurrent_queue::page_allocator_type
tbb::internal::allocator_rebind< A, char >::type page_allocator_type
Allocator type.
Definition: concurrent_queue.h:39
tbb::strict_ppl::concurrent_queue::allocator_type
A allocator_type
Allocator type.
Definition: concurrent_queue.h:81
tbb::strict_ppl::concurrent_queue::concurrent_queue
concurrent_queue(concurrent_queue &&src)
Move constructors.
Definition: concurrent_queue.h:107
tbb::strict_ppl::concurrent_queue::clear
void clear()
Clear the queue. not thread-safe.
Definition: concurrent_queue.h:196
tbb::strict_ppl::concurrent_queue::empty
bool empty() const
Equivalent to size()==0.
Definition: concurrent_queue.h:160
tbb::strict_ppl::concurrent_queue::concurrent_queue
concurrent_queue(const concurrent_queue &src, const allocator_type &a=allocator_type())
Copy constructor.
Definition: concurrent_queue.h:99
tbb::strict_ppl::concurrent_queue::my_allocator
page_allocator_type my_allocator
Definition: concurrent_queue.h:40
tbb::strict_ppl::concurrent_queue::get_allocator
allocator_type get_allocator() const
Return allocator object.
Definition: concurrent_queue.h:166
tbb::strict_ppl::concurrent_queue::value_type
T value_type
Element type in the queue.
Definition: concurrent_queue.h:66
tbb::concurrent_bounded_queue
A high-performance thread-safe blocking concurrent bounded queue.
Definition: concurrent_queue.h:210
tbb::concurrent_bounded_queue::try_push
bool try_push(const T &source)
Enqueue an item at tail of queue if queue is not already full.
Definition: concurrent_queue.h:385
tbb::concurrent_bounded_queue::emplace
void emplace(Arguments &&... args)
Definition: concurrent_queue.h:363
tbb::concurrent_bounded_queue::const_iterator
internal::concurrent_queue_iterator< concurrent_bounded_queue, const T > const_iterator
Definition: concurrent_queue.h:439
tbb::concurrent_bounded_queue::concurrent_bounded_queue
concurrent_bounded_queue(concurrent_bounded_queue &&src)
Move constructors.
Definition: concurrent_queue.h:316
tbb::concurrent_bounded_queue::clear
void clear()
clear the queue. not thread-safe.
Definition: concurrent_queue.h:467
tbb::concurrent_bounded_queue::allocate_page
virtual page * allocate_page() __TBB_override
custom allocator
Definition: concurrent_queue.h:267
tbb::concurrent_bounded_queue::try_pop
bool try_pop(T &destination)
Attempt to dequeue an item from head of queue.
Definition: concurrent_queue.h:407
tbb::concurrent_bounded_queue::size
size_type size() const
Return number of pushes minus number of pops.
Definition: concurrent_queue.h:415
tbb::concurrent_bounded_queue::get_ref
T & get_ref(page &p, size_t index)
Definition: concurrent_queue.h:228
tbb::concurrent_bounded_queue::deallocate_page
virtual void deallocate_page(page *p) __TBB_override
custom de-allocator
Definition: concurrent_queue.h:275
tbb::concurrent_bounded_queue::iterator
internal::concurrent_queue_iterator< concurrent_bounded_queue, T > iterator
Definition: concurrent_queue.h:438
tbb::concurrent_bounded_queue::move_page_item
virtual void move_page_item(page &dst, size_t dindex, const page &src, size_t sindex) __TBB_override
Definition: concurrent_queue.h:252
tbb::concurrent_bounded_queue::padded_page
concurrent_queue_base_v3::padded_page< T > padded_page
Definition: concurrent_queue.h:217
tbb::concurrent_bounded_queue::try_emplace
bool try_emplace(Arguments &&... args)
Definition: concurrent_queue.h:398
tbb::concurrent_bounded_queue::copy_page_item
virtual void copy_page_item(page &dst, size_t dindex, const page &src, size_t sindex) __TBB_override
Definition: concurrent_queue.h:247
tbb::concurrent_bounded_queue::reference
T & reference
Reference type.
Definition: concurrent_queue.h:288
tbb::concurrent_bounded_queue::empty
bool empty() const
Equivalent to size()<=0.
Definition: concurrent_queue.h:418
tbb::concurrent_bounded_queue::push
void push(T &&source)
Move an item at tail of queue.
Definition: concurrent_queue.h:357
tbb::concurrent_bounded_queue::unsafe_end
iterator unsafe_end()
Definition: concurrent_queue.h:445
tbb::concurrent_bounded_queue::value_type
T value_type
Element type in the queue.
Definition: concurrent_queue.h:282
tbb::concurrent_bounded_queue::difference_type
std::ptrdiff_t difference_type
Difference type for iterator.
Definition: concurrent_queue.h:299
tbb::concurrent_bounded_queue::set_capacity
void set_capacity(size_type new_capacity)
Set the capacity.
Definition: concurrent_queue.h:428
tbb::concurrent_bounded_queue::page_allocator_type
tbb::internal::allocator_rebind< A, char >::type page_allocator_type
Definition: concurrent_queue.h:212
tbb::concurrent_bounded_queue::concurrent_bounded_queue
concurrent_bounded_queue(const allocator_type &a=allocator_type())
Construct empty queue.
Definition: concurrent_queue.h:302
tbb::concurrent_bounded_queue::pop
void pop(T &destination)
Dequeue item from head of queue.
Definition: concurrent_queue.h:371
tbb::concurrent_bounded_queue::unsafe_begin
const_iterator unsafe_begin() const
Definition: concurrent_queue.h:446
tbb::concurrent_bounded_queue::assign_and_destroy_item
virtual void assign_and_destroy_item(void *dst, page &src, size_t index) __TBB_override
Definition: concurrent_queue.h:261
tbb::concurrent_bounded_queue::try_push
bool try_push(T &&source)
Move an item at tail of queue if queue is not already full.
Definition: concurrent_queue.h:393
tbb::concurrent_bounded_queue::capacity
size_type capacity() const
Maximum number of allowed elements.
Definition: concurrent_queue.h:421
tbb::concurrent_bounded_queue::copy_specifics
concurrent_queue_base_v3::copy_specifics copy_specifics
Definition: concurrent_queue.h:218
tbb::concurrent_bounded_queue::move_item
virtual void move_item(page &dst, size_t index, const void *src) __TBB_override
Definition: concurrent_queue.h:238
tbb::concurrent_bounded_queue::concurrent_bounded_queue
concurrent_bounded_queue(const concurrent_bounded_queue &src, const allocator_type &a=allocator_type())
Copy constructor.
Definition: concurrent_queue.h:308
tbb::concurrent_bounded_queue::my_allocator
page_allocator_type my_allocator
Allocator type.
Definition: concurrent_queue.h:215
tbb::concurrent_bounded_queue::get_allocator
allocator_type get_allocator() const
return allocator object
Definition: concurrent_queue.h:433
tbb::concurrent_bounded_queue::~concurrent_bounded_queue
~concurrent_bounded_queue()
Destroy queue.
Definition: concurrent_queue.h:461
tbb::concurrent_bounded_queue::unsafe_end
const_iterator unsafe_end() const
Definition: concurrent_queue.h:447
tbb::concurrent_bounded_queue::unsafe_begin
iterator unsafe_begin()
Definition: concurrent_queue.h:444
tbb::concurrent_bounded_queue::allocator_type
A allocator_type
Allocator type.
Definition: concurrent_queue.h:285
tbb::concurrent_bounded_queue::push
void push(const T &source)
Enqueue an item at tail of queue.
Definition: concurrent_queue.h:351
tbb::concurrent_bounded_queue::size_type
std::ptrdiff_t size_type
Integral type for representing size of the queue.
Definition: concurrent_queue.h:296
tbb::concurrent_bounded_queue::concurrent_bounded_queue
concurrent_bounded_queue(concurrent_bounded_queue &&src, const allocator_type &a)
Definition: concurrent_queue.h:322
tbb::concurrent_bounded_queue::copy_item
virtual void copy_item(page &dst, size_t index, const void *src) __TBB_override
Definition: concurrent_queue.h:233
tbb::concurrent_bounded_queue::const_reference
const T & const_reference
Const reference type.
Definition: concurrent_queue.h:291
tbb::concurrent_bounded_queue::concurrent_bounded_queue
concurrent_bounded_queue(InputIterator begin, InputIterator end, const allocator_type &a=allocator_type())
[begin,end) constructor
Definition: concurrent_queue.h:339
tbb::concurrent_bounded_queue::destroyer
Class used to ensure exception-safety of method "pop".
Definition: concurrent_queue.h:221
tbb::concurrent_bounded_queue::destroyer::~destroyer
~destroyer()
Definition: concurrent_queue.h:225
tbb::concurrent_bounded_queue::destroyer::destroyer
destroyer(T &value)
Definition: concurrent_queue.h:224
tbb::concurrent_bounded_queue::destroyer::my_value
T & my_value
Definition: concurrent_queue.h:222
tbb::internal::allocator_rebind::type
allocator_traits< Alloc >::template rebind_alloc< T >::other type
Definition: _allocator_traits.h:149
tbb::strict_ppl::internal::concurrent_queue_base_v3
base class of concurrent_queue
Definition: _concurrent_queue_impl.h:421
tbb::strict_ppl::internal::concurrent_queue_base_v3::internal_push
void internal_push(const void *src, item_constructor_t construct_item)
Enqueue item at tail of queue.
Definition: _concurrent_queue_impl.h:469
tbb::strict_ppl::internal::concurrent_queue_base_v3::internal_swap
void internal_swap(concurrent_queue_base_v3 &src)
swap internal representation
Definition: _concurrent_queue_impl.h:499
tbb::strict_ppl::internal::concurrent_queue_base_v3::assign
void assign(const concurrent_queue_base_v3 &src, item_constructor_t construct_item)
copy or move internal representation
Definition: _concurrent_queue_impl.h:589
tbb::strict_ppl::internal::concurrent_queue_base_v3::internal_empty
bool internal_empty() const
check if the queue is empty; thread safe
Definition: _concurrent_queue_impl.h:565
tbb::strict_ppl::internal::concurrent_queue_base_v3::internal_size
size_t internal_size() const
Get size of queue; result may be invalid if queue is modified concurrently.
Definition: _concurrent_queue_impl.h:553
tbb::strict_ppl::internal::concurrent_queue_base_v3::internal_try_pop
bool internal_try_pop(void *dst)
Attempt to dequeue item from queue.
Definition: _concurrent_queue_impl.h:524
tbb::strict_ppl::internal::concurrent_queue_iterator
Meets requirements of a forward iterator for STL.
Definition: _concurrent_queue_impl.h:749
tbb::internal::concurrent_queue_iterator
Meets requirements of a forward iterator for STL.
Definition: _concurrent_queue_impl.h:1013
tbb::internal::concurrent_queue_base_v3
For internal use only.
Definition: _concurrent_queue_impl.h:826
tbb::internal::concurrent_queue_base_v3::internal_pop
void __TBB_EXPORTED_METHOD internal_pop(void *dst)
Dequeue item from head of queue.
Definition: concurrent_queue.cpp:414
tbb::internal::concurrent_queue_base_v3::internal_abort
void __TBB_EXPORTED_METHOD internal_abort()
Abort all pending queue operations.
Definition: concurrent_queue.cpp:460
tbb::internal::concurrent_queue_base_v3::assign
void __TBB_EXPORTED_METHOD assign(const concurrent_queue_base_v3 &src)
copy internal representation
Definition: concurrent_queue.cpp:569
tbb::internal::concurrent_queue_base_v3::internal_set_capacity
void __TBB_EXPORTED_METHOD internal_set_capacity(ptrdiff_t capacity, size_t element_size)
Set the queue capacity.
Definition: concurrent_queue.cpp:531
tbb::internal::concurrent_queue_base_v3::internal_push
void __TBB_EXPORTED_METHOD internal_push(const void *src)
Enqueue item at tail of queue using copy operation.
Definition: concurrent_queue.cpp:363
tbb::internal::concurrent_queue_base_v3::internal_push_if_not_full
bool __TBB_EXPORTED_METHOD internal_push_if_not_full(const void *src)
Attempt to enqueue item onto queue using copy operation.
Definition: concurrent_queue.cpp:491
tbb::internal::concurrent_queue_base_v3::internal_pop_if_present
bool __TBB_EXPORTED_METHOD internal_pop_if_present(void *dst)
Attempt to dequeue item from queue.
Definition: concurrent_queue.cpp:467
tbb::internal::concurrent_queue_base_v3::my_capacity
ptrdiff_t my_capacity
Capacity of the queue.
Definition: _concurrent_queue_impl.h:844
tbb::internal::concurrent_queue_base_v3::internal_swap
void internal_swap(concurrent_queue_base_v3 &src)
swap queues
Definition: _concurrent_queue_impl.h:917
tbb::internal::concurrent_queue_base_v3::internal_size
ptrdiff_t __TBB_EXPORTED_METHOD internal_size() const
Get size of queue.
Definition: concurrent_queue.cpp:519
tbb::internal::concurrent_queue_base_v3::internal_empty
bool __TBB_EXPORTED_METHOD internal_empty() const
Check if the queue is empty.
Definition: concurrent_queue.cpp:524
tbb::internal::concurrent_queue_base_v3::copy_specifics
copy_specifics
Definition: _concurrent_queue_impl.h:852
tbb::internal::concurrent_queue_base_v3::move
@ move
Definition: _concurrent_queue_impl.h:852
tbb::internal::concurrent_queue_base_v3::items_per_page
size_t items_per_page
Always a power of 2.
Definition: _concurrent_queue_impl.h:847
tbb::internal::concurrent_queue_base_v3::page
Prefix on a page.
Definition: _concurrent_queue_impl.h:838
tbb::internal::concurrent_queue_base_v3::padded_page
Definition: _concurrent_queue_impl.h:858
tbb::internal::concurrent_queue_base_v8
For internal use only.
Definition: _concurrent_queue_impl.h:940
tbb::internal::concurrent_queue_base_v8::internal_push_move_if_not_full
bool __TBB_EXPORTED_METHOD internal_push_move_if_not_full(const void *src)
Attempt to enqueue item onto queue using move operation.
Definition: concurrent_queue.cpp:495
tbb::internal::concurrent_queue_base_v8::internal_push_move
void __TBB_EXPORTED_METHOD internal_push_move(const void *src)
Enqueue item at tail of queue using move operation.
Definition: concurrent_queue.cpp:367
tbb::internal::concurrent_queue_base_v8::move_content
void __TBB_EXPORTED_METHOD move_content(concurrent_queue_base_v8 &src)
move items
Definition: concurrent_queue.cpp:573
tbb::internal::no_copy
Base class for types that should not be copied or assigned.
Definition: tbb_stddef.h:330

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.