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 14*bbb0f2c7SArthur O'Dwyer #include <__config> 15*bbb0f2c7SArthur O'Dwyer #include <__threading_support> 168cedf04aSEric Fiselier 178cedf04aSEric Fiselier #if !defined(_LIBCPP_HAS_NO_THREADS) 188cedf04aSEric Fiselier # if _LIBCPP_ABI_VERSION == 1 || !defined(_LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION) 198cedf04aSEric Fiselier # define NEEDS_CONDVAR_DESTRUCTOR 208cedf04aSEric Fiselier # endif 218cedf04aSEric Fiselier #endif 228cedf04aSEric Fiselier 238cedf04aSEric Fiselier _LIBCPP_BEGIN_NAMESPACE_STD 248cedf04aSEric Fiselier 258cedf04aSEric Fiselier #ifdef NEEDS_CONDVAR_DESTRUCTOR 268cedf04aSEric Fiselier 278cedf04aSEric Fiselier class _LIBCPP_TYPE_VIS condition_variable 288cedf04aSEric Fiselier { 298cedf04aSEric Fiselier __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; 308cedf04aSEric Fiselier public: 318cedf04aSEric Fiselier _LIBCPP_INLINE_VISIBILITY 328cedf04aSEric Fiselier constexpr condition_variable() noexcept = default; 338cedf04aSEric Fiselier 348cedf04aSEric Fiselier ~condition_variable(); 358cedf04aSEric Fiselier 368cedf04aSEric Fiselier condition_variable(const condition_variable&) = delete; 378cedf04aSEric Fiselier condition_variable& operator=(const condition_variable&) = delete; 388cedf04aSEric Fiselier }; 398cedf04aSEric Fiselier ~condition_variable()408cedf04aSEric Fiseliercondition_variable::~condition_variable() 418cedf04aSEric Fiselier { 428cedf04aSEric Fiselier __libcpp_condvar_destroy(&__cv_); 438cedf04aSEric Fiselier } 448cedf04aSEric Fiselier #endif 458cedf04aSEric Fiselier 468cedf04aSEric Fiselier _LIBCPP_END_NAMESPACE_STD 47