33 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// <semaphore>13 14#include <semaphore>15#include <thread>16 17#include "make_test_thread.h"18#include "test_macros.h"19 20int main(int, char**)21{22 std::counting_semaphore<> s(2);23 24 std::thread t = support::make_test_thread([&](){25 s.acquire();26 });27 t.join();28 29 s.acquire();30 31 return 0;32}33