1 //===----------------------------------------------------------------------===//
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-exception
7 //===----------------------------------------------------------------------===//
9 #include "__cxxabi_config.h"
12 // Tell the implementation that we're building the actual implementation
13 // (and not testing it)
14 #define BUILDING_CXA_GUARD
15 #include "cxa_guard_impl.h"
18 This implementation must be careful to not call code external to this file
19 which will turn around and try to call __cxa_guard_acquire reentrantly.
20 For this reason, the headers of this file are as restricted as possible.
21 Previous implementations of this code for __APPLE__ have used
22 std::__libcpp_mutex_lock and the abort_message utility without problem. This
23 implementation also uses std::__libcpp_condvar_wait which has tested
27 namespace __cxxabiv1
{
29 #if defined(_LIBCXXABI_GUARD_ABI_ARM)
30 using guard_type
= uint32_t;
32 using guard_type
= uint64_t;
37 _LIBCXXABI_FUNC_VIS
int __cxa_guard_acquire(guard_type
* raw_guard_object
) {
38 SelectedImplementation
imp(raw_guard_object
);
39 return static_cast<int>(imp
.cxa_guard_acquire());
42 _LIBCXXABI_FUNC_VIS
void __cxa_guard_release(guard_type
*raw_guard_object
) {
43 SelectedImplementation
imp(raw_guard_object
);
44 imp
.cxa_guard_release();
47 _LIBCXXABI_FUNC_VIS
void __cxa_guard_abort(guard_type
*raw_guard_object
) {
48 SelectedImplementation
imp(raw_guard_object
);
49 imp
.cxa_guard_abort();