aboutsummaryrefslogtreecommitdiff
path: root/libcxx/include/semaphore
diff options
context:
space:
mode:
authorLouis Dionne <ldionne.2@gmail.com>2024-04-16 10:57:48 -0400
committerGitHub <noreply@github.com>2024-04-16 10:57:48 -0400
commit9ddedf07ed80076e0e419940753aeaaf719a09ec (patch)
treebf2083013f512c95493241f6b305264d53a4a90c /libcxx/include/semaphore
parent22629bb22a1bea95eebfc9b3171005de107c38f1 (diff)
downloadllvm-9ddedf07ed80076e0e419940753aeaaf719a09ec.zip
llvm-9ddedf07ed80076e0e419940753aeaaf719a09ec.tar.gz
llvm-9ddedf07ed80076e0e419940753aeaaf719a09ec.tar.bz2
[libc++] Deprecate the C++20 synchronization library before C++20 (#86410)
When we initially implemented the C++20 synchronization library, we reluctantly accepted for the implementation to be backported to C++03 upon request from the person who provided the patch. This was when we were only starting to have experience with the issues this can create, so we flinched. Nowadays, we have a much stricter stance about not backporting features to previous standards. We have recently started fixing several bugs (and near bugs) in our implementation of the synchronization library. A recurring theme during these reviews has been how difficult to understand the current code is, and upon inspection it becomes clear that being able to use a few recent C++ features (in particular lambdas) would help a great deal. The code would still be pretty intricate, but it would be a lot easier to reason about the flow of callbacks through things like __thread_poll_with_backoff. As a result, this patch deprecates support for the synchronization library before C++20. In the next release, we can remove that support entirely.
Diffstat (limited to 'libcxx/include/semaphore')
-rw-r--r--libcxx/include/semaphore6
1 files changed, 4 insertions, 2 deletions
diff --git a/libcxx/include/semaphore b/libcxx/include/semaphore
index 1375ec3..cb2f42c 100644
--- a/libcxx/include/semaphore
+++ b/libcxx/include/semaphore
@@ -127,7 +127,7 @@ private:
};
template <ptrdiff_t __least_max_value = _LIBCPP_SEMAPHORE_MAX>
-class counting_semaphore {
+class _LIBCPP_DEPRECATED_ATOMIC_SYNC counting_semaphore {
__atomic_semaphore_base __semaphore_;
public:
@@ -172,7 +172,9 @@ public:
}
};
-using binary_semaphore = counting_semaphore<1>;
+_LIBCPP_SUPPRESS_DEPRECATED_PUSH
+using binary_semaphore _LIBCPP_DEPRECATED_ATOMIC_SYNC = counting_semaphore<1>;
+_LIBCPP_SUPPRESS_DEPRECATED_POP
_LIBCPP_END_NAMESPACE_STD