MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / pop

Method pop

extern/libcds/cds/container/weak_ringbuffer.h:353–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

351 */
352 template <typename Q, typename CopyFunc>
353 bool pop( Q* arr, size_t count, CopyFunc copy )
354 {
355 assert( count < capacity());
356
357 counter_type front = front_.load( memory_model::memory_order_relaxed );
358 assert( static_cast<size_t>( cback_ - front ) < capacity());
359
360 if ( static_cast<size_t>( cback_ - front ) < count ) {
361 cback_ = back_.load( memory_model::memory_order_acquire );
362 if ( static_cast<size_t>( cback_ - front ) < count )
363 return false;
364 }
365
366 // copy data
367 value_cleaner cleaner;
368 for ( size_t i = 0; i < count; ++i, ++front ) {
369 value_type& val = buffer_[buffer_.mod( front )];
370 copy( arr[i], val );
371 cleaner( val );
372 }
373
374 front_.store( front, memory_model::memory_order_release );
375 return true;
376 }
377
378 /// Batch pop - push array \p arr of size \p count with assignment as copy functor
379 /**

Callers

nothing calls this directly

Calls 7

assertClass · 0.85
popFunction · 0.70
dequeueFunction · 0.70
copyFunction · 0.50
loadMethod · 0.45
modMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected