Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
tbb::internal::concurrent_queue_iterator_base_v3 Class Reference

Type-independent portion of concurrent_queue_iterator. More...

#include <_concurrent_queue_impl.h>

Inheritance diagram for tbb::internal::concurrent_queue_iterator_base_v3:
Collaboration diagram for tbb::internal::concurrent_queue_iterator_base_v3:

Protected Member Functions

 concurrent_queue_iterator_base_v3 ()
 Default constructor. More...
 
 concurrent_queue_iterator_base_v3 (const concurrent_queue_iterator_base_v3 &i)
 Copy constructor. More...
 
__TBB_EXPORTED_METHOD concurrent_queue_iterator_base_v3 (const concurrent_queue_base_v3 &queue)
 Obsolete entry point for constructing iterator pointing to head of queue. More...
 
__TBB_EXPORTED_METHOD concurrent_queue_iterator_base_v3 (const concurrent_queue_base_v3 &queue, size_t offset_of_data)
 Construct iterator pointing to head of queue. More...
 
void __TBB_EXPORTED_METHOD assign (const concurrent_queue_iterator_base_v3 &i)
 Assignment. More...
 
void __TBB_EXPORTED_METHOD advance ()
 Advance iterator one step towards tail of queue. More...
 
__TBB_EXPORTED_METHOD ~concurrent_queue_iterator_base_v3 ()
 Destructor. More...
 

Protected Attributes

voidmy_item
 Pointer to current item. More...
 

Private Member Functions

void initialize (const concurrent_queue_base_v3 &queue, size_t offset_of_data)
 

Private Attributes

concurrent_queue_iterator_repmy_rep
 concurrent_queue over which we are iterating. More...
 

Friends

template<typename C , typename T , typename U >
bool operator== (const concurrent_queue_iterator< C, T > &i, const concurrent_queue_iterator< C, U > &j)
 
template<typename C , typename T , typename U >
bool operator!= (const concurrent_queue_iterator< C, T > &i, const concurrent_queue_iterator< C, U > &j)
 

Detailed Description

Type-independent portion of concurrent_queue_iterator.

Definition at line 959 of file _concurrent_queue_impl.h.

Constructor & Destructor Documentation

◆ concurrent_queue_iterator_base_v3() [1/4]

tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3 ( )
inlineprotected

Default constructor.

Definition at line 976 of file _concurrent_queue_impl.h.

976 : my_rep(NULL), my_item(NULL) {}
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

◆ concurrent_queue_iterator_base_v3() [2/4]

tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3 ( const concurrent_queue_iterator_base_v3 i)
inlineprotected

Copy constructor.

Definition at line 979 of file _concurrent_queue_impl.h.

979  : my_rep(NULL), my_item(NULL) {
980  assign(i);
981  }
void __TBB_EXPORTED_METHOD assign(const concurrent_queue_iterator_base_v3 &i)
Assignment.
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

References tbb::strict_ppl::internal::concurrent_queue_iterator_base_v3< Value >::assign().

Here is the call graph for this function:

◆ concurrent_queue_iterator_base_v3() [3/4]

__TBB_EXPORTED_METHOD tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3 ( const concurrent_queue_base_v3 queue)
protected

Obsolete entry point for constructing iterator pointing to head of queue.

Does not work correctly for SSE types.

◆ concurrent_queue_iterator_base_v3() [4/4]

__TBB_EXPORTED_METHOD tbb::internal::concurrent_queue_iterator_base_v3::concurrent_queue_iterator_base_v3 ( const concurrent_queue_base_v3 queue,
size_t  offset_of_data 
)
protected

Construct iterator pointing to head of queue.

◆ ~concurrent_queue_iterator_base_v3()

tbb::internal::concurrent_queue_iterator_base_v3::~concurrent_queue_iterator_base_v3 ( )
protected

Destructor.

Definition at line 666 of file concurrent_queue.cpp.

666  {
667  //delete my_rep;
668  cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1);
669  my_rep = NULL;
670 }
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

References tbb::cache_aligned_allocator< T >::deallocate(), and my_rep.

Here is the call graph for this function:

Member Function Documentation

◆ advance()

void tbb::internal::concurrent_queue_iterator_base_v3::advance ( )
protected

Advance iterator one step towards tail of queue.

Definition at line 647 of file concurrent_queue.cpp.

647  {
648  __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
649  size_t k = my_rep->head_counter;
650  const concurrent_queue_base& queue = my_rep->my_queue;
651 #if TBB_USE_ASSERT
652  void* tmp;
653  my_rep->get_item(tmp,k);
654  __TBB_ASSERT( my_item==tmp, NULL );
655 #endif /* TBB_USE_ASSERT */
656  size_t i = modulo_power_of_two( k/concurrent_queue_rep::n_queue, queue.items_per_page );
657  if( i==queue.items_per_page-1 ) {
658  concurrent_queue_base::page*& root = my_rep->array[concurrent_queue_rep::index(k)];
659  root = root->next;
660  }
661  // advance k
662  my_rep->head_counter = ++k;
663  if( !my_rep->get_item(my_item, k) ) advance();
664 }
concurrent_queue_base_v3 concurrent_queue_base
argument_integer_type modulo_power_of_two(argument_integer_type arg, divisor_integer_type divisor)
A function to compute arg modulo divisor where divisor is a power of 2.
Definition: tbb_stddef.h:365
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:169
void __TBB_EXPORTED_METHOD advance()
Advance iterator one step towards tail of queue.
static size_t index(ticket k)
Map ticket to an array index.
static const size_t n_queue
Must be power of 2.
concurrent_queue_base::page * array[concurrent_queue_rep::n_queue]
bool get_item(void *&item, size_t k)
Set item to point to kth element. Return true if at end of queue or item is marked valid; false other...
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

References __TBB_ASSERT, tbb::internal::concurrent_queue_iterator_rep::array, tbb::internal::concurrent_queue_iterator_rep::get_item(), tbb::internal::concurrent_queue_iterator_rep::head_counter, tbb::internal::concurrent_queue_rep::index(), tbb::internal::concurrent_queue_base_v3::items_per_page, tbb::internal::modulo_power_of_two(), my_item, tbb::internal::concurrent_queue_iterator_rep::my_queue, my_rep, tbb::internal::concurrent_queue_rep::n_queue, and tbb::internal::concurrent_queue_base_v3::page::next.

Referenced by initialize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ assign()

void tbb::internal::concurrent_queue_iterator_base_v3::assign ( const concurrent_queue_iterator_base_v3 i)
protected

Assignment.

Definition at line 633 of file concurrent_queue.cpp.

633  {
634  if( my_rep!=other.my_rep ) {
635  if( my_rep ) {
636  cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1);
637  my_rep = NULL;
638  }
639  if( other.my_rep ) {
640  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1);
641  new( my_rep ) concurrent_queue_iterator_rep( *other.my_rep );
642  }
643  }
644  my_item = other.my_item;
645 }
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

References tbb::cache_aligned_allocator< T >::allocate(), tbb::cache_aligned_allocator< T >::deallocate(), my_item, and my_rep.

Here is the call graph for this function:

◆ initialize()

void tbb::internal::concurrent_queue_iterator_base_v3::initialize ( const concurrent_queue_base_v3 queue,
size_t  offset_of_data 
)
private

Definition at line 618 of file concurrent_queue.cpp.

618  {
619  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1);
620  new( my_rep ) concurrent_queue_iterator_rep(queue,offset_of_last);
621  size_t k = my_rep->head_counter;
622  if( !my_rep->get_item(my_item, k) ) advance();
623 }
void __TBB_EXPORTED_METHOD advance()
Advance iterator one step towards tail of queue.
bool get_item(void *&item, size_t k)
Set item to point to kth element. Return true if at end of queue or item is marked valid; false other...
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.

References advance(), tbb::cache_aligned_allocator< T >::allocate(), tbb::internal::concurrent_queue_iterator_rep::get_item(), tbb::internal::concurrent_queue_iterator_rep::head_counter, my_item, and my_rep.

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

template<typename C , typename T , typename U >
bool operator!= ( const concurrent_queue_iterator< C, T > &  i,
const concurrent_queue_iterator< C, U > &  j 
)
friend

Definition at line 1065 of file _concurrent_queue_impl.h.

1065  {
1066  return i.my_item!=j.my_item;
1067 }

◆ operator==

template<typename C , typename T , typename U >
bool operator== ( const concurrent_queue_iterator< C, T > &  i,
const concurrent_queue_iterator< C, U > &  j 
)
friend

Definition at line 1060 of file _concurrent_queue_impl.h.

1060  {
1061  return i.my_item==j.my_item;
1062 }

Member Data Documentation

◆ my_item

void* tbb::internal::concurrent_queue_iterator_base_v3::my_item
protected

Pointer to current item.

Definition at line 973 of file _concurrent_queue_impl.h.

Referenced by advance(), assign(), initialize(), tbb::internal::operator!=(), and tbb::internal::operator==().

◆ my_rep

concurrent_queue_iterator_rep* tbb::internal::concurrent_queue_iterator_base_v3::my_rep
private

concurrent_queue over which we are iterating.

NULL if one past last element in queue.

Definition at line 962 of file _concurrent_queue_impl.h.

Referenced by advance(), assign(), initialize(), and ~concurrent_queue_iterator_base_v3().


The documentation for this class was generated from the following files:

Copyright © 2005-2019 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.