1eb8650a7SLouis Dionne //===----------------------------------------------------------------------===// 28cedf04aSEric Fiselier // 38cedf04aSEric Fiselier // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 48cedf04aSEric Fiselier // See https://llvm.org/LICENSE.txt for license information. 58cedf04aSEric Fiselier // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 68cedf04aSEric Fiselier // 78cedf04aSEric Fiselier //===----------------------------------------------------------------------===// 88cedf04aSEric Fiselier 98cedf04aSEric Fiselier // Define ~condition_variable. 108cedf04aSEric Fiselier // 118cedf04aSEric Fiselier // On some platforms ~condition_variable has been made trivial and the 128cedf04aSEric Fiselier // definition is only provided for ABI compatibility. 138cedf04aSEric Fiselier 14bbb0f2c7SArthur O'Dwyer #include <__config> 157162fd75SLouis Dionne #include <__thread/support.h> 168cedf04aSEric Fiselier 17*ba87515fSNikolas Klauser #if _LIBCPP_ABI_VERSION == 1 || !_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION 188cedf04aSEric Fiselier # define NEEDS_CONDVAR_DESTRUCTOR 198cedf04aSEric Fiselier #endif 208cedf04aSEric Fiselier 218cedf04aSEric Fiselier _LIBCPP_BEGIN_NAMESPACE_STD 228cedf04aSEric Fiselier 238cedf04aSEric Fiselier #ifdef NEEDS_CONDVAR_DESTRUCTOR 248cedf04aSEric Fiselier 259783f28cSLouis Dionne class _LIBCPP_EXPORTED_FROM_ABI condition_variable { 268cedf04aSEric Fiselier __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; 279783f28cSLouis Dionne 288cedf04aSEric Fiselier public: 299783f28cSLouis Dionne _LIBCPP_HIDE_FROM_ABI constexpr condition_variable() noexcept = default; 308cedf04aSEric Fiselier 318cedf04aSEric Fiselier ~condition_variable(); 328cedf04aSEric Fiselier 338cedf04aSEric Fiselier condition_variable(const condition_variable&) = delete; 348cedf04aSEric Fiselier condition_variable& operator=(const condition_variable&) = delete; 358cedf04aSEric Fiselier }; 368cedf04aSEric Fiselier 379783f28cSLouis Dionne condition_variable::~condition_variable() { __libcpp_condvar_destroy(&__cv_); } 388cedf04aSEric Fiselier #endif 398cedf04aSEric Fiselier 408cedf04aSEric Fiselier _LIBCPP_END_NAMESPACE_STD 41