tbb::internal::concurrent_queue_rep Class Reference

Internal representation of a ConcurrentQueue. More...

Collaboration diagram for tbb::internal::concurrent_queue_rep:

## Public Member Functions

micro_queue & | choose (ticket k)

## Static Public Member Functions

static size_t | index (ticket k)
| Map ticket to an array index. More...

## Public Attributes

atomic< ticket > | head_counter
concurrent_monitor | items_avail
atomic< size_t > | n_invalid_entries
char | pad1 [NFS_MaxLineSize-((sizeof(atomic< ticket >)+sizeof(concurrent_monitor)+sizeof(atomic< size_t >))&(NFS_MaxLineSize-1))]
atomic< ticket > | tail_counter
concurrent_monitor | slots_avail
char | pad2 [NFS_MaxLineSize-((sizeof(atomic< ticket >)+sizeof(concurrent_monitor))&(NFS_MaxLineSize-1))]
micro_queue | array [n_queue]
atomic< unsigned > | abort_counter

## Static Public Attributes

static const size_t | n_queue = 8
| Must be power of 2. More...
static const ptrdiff_t | infinite_capacity = ptrdiff_t(~size_t(0)/2)
| Value for effective_capacity that denotes unbounded queue. More...

## Static Private Attributes

static const size_t | phi = 3
| Approximately n_queue/golden ratio. More...

## Friends

struct | micro_queue

## Detailed Description

Internal representation of a ConcurrentQueue.

For efficiency, this class has no constructor. The caller is expected to zero-initialize it.

Definition at line 112 of file concurrent_queue.cpp.

## Member Function Documentation

## choose()

micro_queue& tbb::internal::concurrent_queue_rep::choose | ( | ticket | k | ) |

inline

Definition at line 139 of file concurrent_queue.cpp.

{
// The formula here approximates LRU in a cache-oblivious way.
return array[index(k)];
}
tbb::internal::concurrent_queue_rep::array
micro_queue array[n_queue]
Definition: concurrent_queue.cpp:137
tbb::internal::concurrent_queue_rep::index
static size_t index(ticket k)
Map ticket to an array index.
Definition: concurrent_queue.cpp:125

References array, and index().

Referenced by tbb::internal::concurrent_queue_base_v3::internal_insert_if_not_full(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), and tbb::internal::concurrent_queue_base_v3::internal_pop_if_present().

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

## index()

static size_t tbb::internal::concurrent_queue_rep::index | ( | ticket | k | ) |

inline static

Map ticket to an array index.

Definition at line 125 of file concurrent_queue.cpp.

{
return k*phi%n_queue;
}
tbb::internal::concurrent_queue_rep::phi
static const size_t phi
Approximately n_queue/golden ratio.
Definition: concurrent_queue.cpp:118
tbb::internal::concurrent_queue_rep::n_queue
static const size_t n_queue
Must be power of 2.
Definition: concurrent_queue.cpp:122

References n_queue, and phi.

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::advance(), choose(), and tbb::internal::concurrent_queue_iterator_rep::get_item().

Here is the caller graph for this function:

## Friends And Related Function Documentation

## micro_queue

friend struct micro_queue

friend

Definition at line 115 of file concurrent_queue.cpp.

## Member Data Documentation

## abort_counter

atomic<unsigned> tbb::internal::concurrent_queue_rep::abort_counter

Definition at line 144 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::internal_abort(), tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), and tbb::internal::concurrent_queue_base_v3::internal_pop().

## array

micro_queue tbb::internal::concurrent_queue_rep::array[n_queue]

Definition at line 137 of file concurrent_queue.cpp.

Referenced by choose(), tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::concurrent_queue_iterator_rep::concurrent_queue_iterator_rep(), tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_finish_clear(), and tbb::internal::concurrent_queue_base_v3::~concurrent_queue_base_v3().

## head_counter

atomic<ticket> tbb::internal::concurrent_queue_rep::head_counter

Definition at line 129 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_empty(), tbb::internal::concurrent_queue_base_v3::internal_insert_if_not_full(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), tbb::internal::concurrent_queue_base_v3::internal_pop_if_present(), and tbb::internal::concurrent_queue_base_v3::internal_size().

## infinite_capacity

const ptrdiff_t tbb::internal::concurrent_queue_rep::infinite_capacity = ptrdiff_t(~size_t(0)/2)

static

Value for effective_capacity that denotes unbounded queue.

Definition at line 147 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::internal_set_capacity().

## items_avail

concurrent_monitor tbb::internal::concurrent_queue_rep::items_avail

Definition at line 130 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::concurrent_queue_base_v3::internal_abort(), tbb::internal::concurrent_queue_base_v3::internal_insert_if_not_full(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), and tbb::internal::concurrent_queue_base_v3::internal_pop().

## n_invalid_entries

atomic<size_t> tbb::internal::concurrent_queue_rep::n_invalid_entries

Definition at line 131 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_empty(), tbb::internal::concurrent_queue_base_v3::internal_size(), tbb::internal::micro_queue::pop(), and tbb::internal::micro_queue::push().

## n_queue

const size_t tbb::internal::concurrent_queue_rep::n_queue = 8

static

Must be power of 2.

Definition at line 122 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_iterator_base_v3::advance(), tbb::internal::micro_queue::assign(), tbb::internal::concurrent_queue_iterator_rep::concurrent_queue_iterator_rep(), tbb::internal::concurrent_queue_iterator_rep::get_item(), index(), tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_finish_clear(), tbb::internal::micro_queue::make_invalid(), tbb::internal::micro_queue::pop(), tbb::internal::micro_queue::push(), and tbb::internal::concurrent_queue_base_v3::~concurrent_queue_base_v3().

## pad1

char tbb::internal::concurrent_queue_rep::pad1[NFS_MaxLineSize-((sizeof(atomic< ticket >)+sizeof(concurrent_monitor)+sizeof(atomic< size_t >))&(NFS_MaxLineSize-1))]

Definition at line 132 of file concurrent_queue.cpp.

## pad2

char tbb::internal::concurrent_queue_rep::pad2[NFS_MaxLineSize-((sizeof(atomic< ticket >)+sizeof(concurrent_monitor))&(NFS_MaxLineSize-1))]

Definition at line 136 of file concurrent_queue.cpp.

## phi

const size_t tbb::internal::concurrent_queue_rep::phi = 3

static private

Approximately n_queue/golden ratio.

Definition at line 118 of file concurrent_queue.cpp.

Referenced by index().

## slots_avail

concurrent_monitor tbb::internal::concurrent_queue_rep::slots_avail

Definition at line 135 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::concurrent_queue_base_v3::internal_abort(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), and tbb::internal::concurrent_queue_base_v3::internal_pop_if_present().

## tail_counter

atomic<ticket> tbb::internal::concurrent_queue_rep::tail_counter

Definition at line 134 of file concurrent_queue.cpp.

Referenced by tbb::internal::concurrent_queue_base_v3::concurrent_queue_base_v3(), tbb::internal::concurrent_queue_iterator_rep::get_item(), tbb::internal::concurrent_queue_base_v3::internal_assign(), tbb::internal::concurrent_queue_base_v3::internal_empty(), tbb::internal::concurrent_queue_base_v3::internal_insert_if_not_full(), tbb::internal::concurrent_queue_base_v3::internal_insert_item(), tbb::internal::concurrent_queue_base_v3::internal_pop(), tbb::internal::concurrent_queue_base_v3::internal_pop_if_present(), and tbb::internal::concurrent_queue_base_v3::internal_size().

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

- concurrent_queue.cpp

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.