MCPcopy Create free account
hub / github.com/coin-or/CppAD / thread_alloc

Function thread_alloc

example/utility/thread_alloc.cpp:200–227  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199
200bool thread_alloc(void)
201{ bool ok = true;
202 using CppAD::thread_alloc;
203
204 // check that there is only on thread
205 ok &= thread_alloc::num_threads() == 1;
206 // so thread number must be zero
207 ok &= thread_alloc::thread_num() == 0;
208 // and we are in sequential execution mode
209 ok &= thread_alloc::in_parallel() == false;
210
211 // Instruct thread_alloc to hold onto memory. This makes memory
212 // allocation faster (especially when there are multiple threads).
213 thread_alloc::hold_memory(true);
214
215 // run raw allocation tests
216 ok &= raw_allocate();
217
218 // run typed allocation tests
219 ok &= type_allocate();
220
221 // check alignment
222 ok &= check_alignment();
223
224 // return allocator to its default mode
225 thread_alloc::hold_memory(false);
226 return ok;
227}
228
229
230// END C++

Callers

nothing calls this directly

Calls 5

raw_allocateFunction · 0.85
type_allocateFunction · 0.85
check_alignmentFunction · 0.85
thread_numFunction · 0.50
in_parallelFunction · 0.50

Tested by

no test coverage detected