2 #include <cds/gc/dhp.h>
4 #include <cds/sync/barrier.h>
5 #include <cds_test/stress_test.h>
13 typedef cds_others::SpinBarrier Barrier;
15 class BarrierTest : public cds_test::stress_fixture {
17 static Barrier *barrier;
19 static const int kThreads = 6;
20 static const int kPassCount = 10000;
22 static void SetUpTestCase() {}
24 static void TearDownTestCase() {
25 assert (count == kPassCount*kPassCount);
28 static void Thread() {
29 for (int i = 0; i < kPassCount; i++) {
30 for (int j = 0; j < kPassCount; j++) {
31 if (barrier->wait()) {
39 Barrier *BarrierTest::barrier;
40 int BarrierTest::count;
41 const int BarrierTest::kThreads;
43 TEST_F(BarrierTest, Wait) {
44 barrier = new Barrier(kThreads);
45 int num_threads = kThreads;
46 std::thread *threads = new std::thread[num_threads];
47 for (int i = 0; i < num_threads; i++) {
48 threads[i] = std::thread(Thread);
51 for (int i = 0; i < num_threads; i++) {