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

Method dequeue

benchmarks/dlib/queue/queue_kernel_2.h:295–321  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

293 typename mem_manager
294 >
295 void queue_kernel_2<T,block_size,mem_manager>::
296 dequeue (
297 T& item
298 )
299 {
300 // swap out into item
301 exchange(item,out->item[out_pos]);
302
303 ++out_pos;
304 --queue_size;
305
306 // if this was the last element in this node then remove this node
307 if (out_pos == block_size)
308 {
309 out_pos = 0;
310 node* temp = out;
311 out = out->next;
312 pool.deallocate(temp);
313 }
314 else if (queue_size == 0)
315 {
316 pool.deallocate(out);
317 }
318
319 // put the enumerator at the start
320 reset();
321 }
322
323// ----------------------------------------------------------------------------------------
324

Callers

nothing calls this directly

Calls 2

exchangeFunction · 0.85
deallocateMethod · 0.45

Tested by

no test coverage detected