brintos

brintos / llvm-project-archived public Read only

0
0
Text · 797 B · b57a06d Raw
34 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8//9// UNSUPPORTED: no-threads10// UNSUPPORTED: c++03, c++11, c++14, c++1711 12// <barrier>13 14#include <barrier>15#include <thread>16 17#include "make_test_thread.h"18#include "test_macros.h"19 20int main(int, char**)21{22  std::barrier<> b(2);23 24  std::thread t = support::make_test_thread([&](){25    for(int i = 0; i < 10; ++i)26      b.arrive_and_wait();27  });28  for(int i = 0; i < 10; ++i)29    b.arrive_and_wait();30  t.join();31 32  return 0;33}34