summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/make/pseudo_barrier.h
blob: 8a543344028840567f192a7b31b644e273def62a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <atomic>
#include <thread>

typedef std::atomic<int> pseudo_barrier_t;

static inline void pseudo_barrier_wait(pseudo_barrier_t &barrier) {
  --barrier;
  while (barrier > 0)
    std::this_thread::yield();
  std::this_thread::sleep_for(std::chrono::milliseconds(100));
}

static inline void pseudo_barrier_init(pseudo_barrier_t &barrier, int count) {
  barrier = count;
}
OpenPOWER on IntegriCloud