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

Method push

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

Source from the content-addressed store, hash-verified

195 */
196 template <typename Q, typename CopyFunc>
197 bool push( Q* arr, size_t count, CopyFunc copy )
198 {
199 assert( count < capacity());
200 counter_type back = back_.load( memory_model::memory_order_relaxed );
201
202 assert( static_cast<size_t>( back - pfront_ ) <= capacity());
203
204 if ( static_cast<size_t>( pfront_ + capacity() - back ) < count ) {
205 pfront_ = front_.load( memory_model::memory_order_acquire );
206
207 if ( static_cast<size_t>( pfront_ + capacity() - back ) < count ) {
208 // not enough space
209 return false;
210 }
211 }
212
213 // copy data
214 for ( size_t i = 0; i < count; ++i, ++back )
215 copy( buffer_[buffer_.mod( back )], arr[i] );
216
217 back_.store( back, memory_model::memory_order_release );
218
219 return true;
220 }
221
222 /// Batch push - push array \p arr of size \p count with assignment as copy functor
223 /**

Callers

nothing calls this directly

Calls 8

assertClass · 0.85
pushFunction · 0.70
enqueueFunction · 0.70
copyFunction · 0.50
moveFunction · 0.50
loadMethod · 0.45
modMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected