20 #include "gtest/gtest.h" 25 TEST(Barrier, SanityTest) {
32 auto thread_func = [&] {
33 if (barrier->
Block()) {
45 std::vector<std::thread> threads;
46 for (
int i = 0;
i < kNumThreads - 1; ++
i) {
47 threads.push_back(std::thread(thread_func));
61 EXPECT_EQ(counter, 0);
65 threads.push_back(std::thread(thread_func));
68 for (
auto& thread : threads) {
74 EXPECT_EQ(counter, kNumThreads);
void SleepFor(absl::Duration duration)
TEST(Barrier, SanityTest)
constexpr Duration Seconds(int64_t n)
constexpr int32_t kNumThreads