MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / concurrent_queue_base_v3

Method concurrent_queue_base_v3

benchmarks/tbb/concurrent_queue.cpp:350–367  ·  view source on GitHub ↗

------------------------------------------------------------------------ concurrent_queue_base ------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

348// concurrent_queue_base
349//------------------------------------------------------------------------
350concurrent_queue_base_v3::concurrent_queue_base_v3( size_t item_sz ) {
351 items_per_page = item_sz<= 8 ? 32 :
352 item_sz<= 16 ? 16 :
353 item_sz<= 32 ? 8 :
354 item_sz<= 64 ? 4 :
355 item_sz<=128 ? 2 :
356 1;
357 my_capacity = size_t(-1)/(item_sz>1 ? item_sz : 2);
358 my_rep = cache_aligned_allocator<concurrent_queue_rep>().allocate(1);
359 __TBB_ASSERT( (size_t)my_rep % NFS_GetLineSize()==0, "alignment error" );
360 __TBB_ASSERT( (size_t)&my_rep->head_counter % NFS_GetLineSize()==0, "alignment error" );
361 __TBB_ASSERT( (size_t)&my_rep->tail_counter % NFS_GetLineSize()==0, "alignment error" );
362 __TBB_ASSERT( (size_t)&my_rep->array % NFS_GetLineSize()==0, "alignment error" );
363 memset(my_rep,0,sizeof(concurrent_queue_rep));
364 new ( &my_rep->items_avail ) concurrent_monitor();
365 new ( &my_rep->slots_avail ) concurrent_monitor();
366 this->item_size = item_sz;
367}
368
369concurrent_queue_base_v3::~concurrent_queue_base_v3() {
370 size_t nq = my_rep->n_queue;

Callers

nothing calls this directly

Calls 2

NFS_GetLineSizeFunction · 0.85
allocateMethod · 0.45

Tested by

no test coverage detected