| 1 | // RUN: %clangxx_tsan %s -o %t |
|---|---|
| 2 | // RUN: %run %t 2>&1 | FileCheck %s |
| 3 | |
| 4 | // bench.h needs pthread barriers which are not available on OS X |
| 5 | // UNSUPPORTED: darwin |
| 6 | |
| 7 | #include "bench.h" |
| 8 | |
| 9 | void thread(int tid) { |
| 10 | void **blocks = new void *[bench_mode]; |
| 11 | for (int i = 0; i < bench_niter; i++) { |
| 12 | for (int j = 0; j < bench_mode; j++) |
| 13 | blocks[j] = malloc(size: 8); |
| 14 | for (int j = 0; j < bench_mode; j++) |
| 15 | free(ptr: blocks[j]); |
| 16 | } |
| 17 | delete[] blocks; |
| 18 | } |
| 19 | |
| 20 | void bench() { start_thread_group(nth: bench_nthread, f: thread); } |
| 21 | |
| 22 | // CHECK: DONE |
| 23 |
