| 198 | |
| 199 | |
| 200 | bool 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++ |
nothing calls this directly
no test coverage detected