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#include <cassert>17 18#include "make_test_thread.h"19#include "test_macros.h"20 21int main(int, char**)22{23 std::barrier<> b(2);24 25 std::thread t = support::make_test_thread([&](){26 b.arrive_and_drop();27 });28 29 b.arrive_and_wait();30 b.arrive_and_wait();31 t.join();32 return 0;33}34