bench_single_writer.cc revision 2d1fdb26e458c4ddc04155c1d421bced3ba90cd0
1// RUN: %clangxx_tsan %s -o %t 2// RUN: %run %t 2>&1 | FileCheck %s 3 4#include "bench.h" 5 6int x; 7 8void thread(int tid) { 9 if (tid == 0) { 10 for (int i = 0; i < bench_niter; i++) 11 __atomic_store_n(&x, 0, __ATOMIC_RELEASE); 12 } else { 13 for (int i = 0; i < bench_niter; i++) 14 __atomic_load_n(&x, __ATOMIC_ACQUIRE); 15 } 16} 17 18void bench() { 19 start_thread_group(bench_nthread, thread); 20} 21 22// CHECK: DONE 23 24