brintos

brintos / llvm-project-archived public Read only

0
0
Text · 810 B · 9b42732 Raw
35 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  auto tok = b.arrive();25  std::thread t = support::make_test_thread([&](){26    (void)b.arrive();27  });28  b.wait(std::move(tok));29  t.join();30 31  auto tok2 = b.arrive(2);32  b.wait(std::move(tok2));33  return 0;34}35