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

Method grow

benchmarks/tbb/pipeline.cpp:235–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

233};
234
235void input_buffer::grow( size_type minimum_size ) {
236 size_type old_size = array_size;
237 size_type new_size = old_size ? 2*old_size : initial_buffer_size;
238 while( new_size<minimum_size )
239 new_size*=2;
240 task_info* new_array = cache_aligned_allocator<task_info>().allocate(new_size);
241 task_info* old_array = array;
242 for( size_type i=0; i<new_size; ++i )
243 new_array[i].is_valid = false;
244 long t=low_token;
245 for( size_type i=0; i<old_size; ++i, ++t )
246 new_array[t&(new_size-1)] = old_array[t&(old_size-1)];
247 array = new_array;
248 array_size = new_size;
249 if( old_array )
250 cache_aligned_allocator<task_info>().deallocate(old_array,old_size);
251}
252
253class stage_task: public task, public task_info {
254private:

Callers

nothing calls this directly

Calls 2

allocateMethod · 0.45
deallocateMethod · 0.45

Tested by

no test coverage detected