Home ⌂Doc Index ◂Up ▴
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...
 
concurrent_queue_iterator_base_v3operator= (const concurrent_queue_iterator_base_v3 &i)
 
__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 960 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 977 of file _concurrent_queue_impl.h.

977 : 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 980 of file _concurrent_queue_impl.h.

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

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 662 of file concurrent_queue.cpp.

662  {
663  //delete my_rep;
664  cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1);
665  my_rep = NULL;
666 }
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 643 of file concurrent_queue.cpp.

643  {
644  __TBB_ASSERT( my_item, "attempt to increment iterator past end of queue" );
645  size_t k = my_rep->head_counter;
646  const concurrent_queue_base& queue = my_rep->my_queue;
647 #if TBB_USE_ASSERT
648  void* tmp;
649  my_rep->get_item(tmp,k);
650  __TBB_ASSERT( my_item==tmp, NULL );
651 #endif /* TBB_USE_ASSERT */
652  size_t i = modulo_power_of_two( k/concurrent_queue_rep::n_queue, queue.items_per_page );
653  if( i==queue.items_per_page-1 ) {
654  concurrent_queue_base::page*& root = my_rep->array[concurrent_queue_rep::index(k)];
655  root = root->next;
656  }
657  // advance k
658  my_rep->head_counter = ++k;
659  if( !my_rep->get_item(my_item, k) ) advance();
660 }
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:382
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.
static size_t index(ticket k)
Map ticket to an array index.
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...
static const size_t n_queue
Must be power of 2.
concurrent_queue_base_v3 concurrent_queue_base
concurrent_queue_base::page * array[concurrent_queue_rep::n_queue]
#define __TBB_ASSERT(predicate, comment)
No-op version of __TBB_ASSERT.
Definition: tbb_stddef.h:165
void __TBB_EXPORTED_METHOD advance()
Advance iterator one step towards tail of queue.

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 629 of file concurrent_queue.cpp.

629  {
630  if( my_rep!=other.my_rep ) {
631  if( my_rep ) {
632  cache_aligned_allocator<concurrent_queue_iterator_rep>().deallocate(my_rep, 1);
633  my_rep = NULL;
634  }
635  if( other.my_rep ) {
636  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1);
637  new( my_rep ) concurrent_queue_iterator_rep( *other.my_rep );
638  }
639  }
640  my_item = other.my_item;
641 }
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 614 of file concurrent_queue.cpp.

614  {
615  my_rep = cache_aligned_allocator<concurrent_queue_iterator_rep>().allocate(1);
616  new( my_rep ) concurrent_queue_iterator_rep(queue,offset_of_last);
617  size_t k = my_rep->head_counter;
618  if( !my_rep->get_item(my_item, k) ) advance();
619 }
concurrent_queue_iterator_rep * my_rep
concurrent_queue over which we are iterating.
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...
void __TBB_EXPORTED_METHOD advance()
Advance iterator one step towards tail of queue.

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:

◆ operator=()

concurrent_queue_iterator_base_v3& tbb::internal::concurrent_queue_iterator_base_v3::operator= ( const concurrent_queue_iterator_base_v3 i)
inlineprotected

Definition at line 984 of file _concurrent_queue_impl.h.

984  {
985  assign(i);
986  return *this;
987  }
void __TBB_EXPORTED_METHOD assign(const concurrent_queue_iterator_base_v3 &i)
Assignment.

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

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 1071 of file _concurrent_queue_impl.h.

1071  {
1072  return i.my_item!=j.my_item;
1073 }

◆ 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 1066 of file _concurrent_queue_impl.h.

1066  {
1067  return i.my_item==j.my_item;
1068 }

Member Data Documentation

◆ my_item

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

Pointer to current item.

Definition at line 974 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 963 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-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.