mirror of
https://github.com/llvm/llvm-project.git
synced 2025-05-01 21:56:05 +00:00

The synchronization library was marked as disabled on Apple platforms up to now because we were not 100% sure that it was going to be ABI stable. However, it's been some time since we shipped it in upstream libc++ now and there's been no changes so far. This patch enables the synchronization library on Apple platforms, and hence commits the ABI stability as far as that vendor is concerned. Differential Revision: https://reviews.llvm.org/D96790
43 lines
1.2 KiB
C++
43 lines
1.2 KiB
C++
//===----------------------------------------------------------------------===//
|
|
//
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// UNSUPPORTED: libcpp-has-no-threads
|
|
// UNSUPPORTED: c++03, c++11
|
|
|
|
// This test requires the dylib support introduced in D68480, which shipped in
|
|
// macOS 11.0.
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.15
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.14
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.13
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.12
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.11
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.10
|
|
// XFAIL: use_system_cxx_lib && x86_64-apple-macosx10.9
|
|
|
|
// <semaphore>
|
|
|
|
#include <semaphore>
|
|
#include <thread>
|
|
|
|
#include "make_test_thread.h"
|
|
#include "test_macros.h"
|
|
|
|
int main(int, char**)
|
|
{
|
|
std::counting_semaphore<> s(2);
|
|
|
|
std::thread t = support::make_test_thread([&](){
|
|
s.acquire();
|
|
});
|
|
t.join();
|
|
|
|
s.acquire();
|
|
|
|
return 0;
|
|
}
|