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

Method enqueue

benchmarks/dlib/queue/queue_kernel_2.h:261–286  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259 typename mem_manager
260 >
261 void queue_kernel_2<T,block_size,mem_manager>::
262 enqueue (
263 T& item
264 )
265 {
266 if (queue_size == 0)
267 {
268 out = in = pool.allocate();
269 in_pos = 0;
270 out_pos = 0;
271 }
272 else if (in_pos >= block_size)
273 {
274 in->next = pool.allocate();
275 in_pos = 0;
276 in = in->next;
277 }
278
279 exchange(item,in->item[in_pos]);
280 ++in_pos;
281
282 ++queue_size;
283
284 // put the enumerator at the start
285 reset();
286 }
287
288// ----------------------------------------------------------------------------------------
289

Callers

nothing calls this directly

Calls 2

exchangeFunction · 0.85
allocateMethod · 0.45

Tested by

no test coverage detected