Path: blob/main/system/lib/libcxxabi/src/cxa_guard.cpp
6173 views
//===----------------------------------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "__cxxabi_config.h"9#include "cxxabi.h"1011// Tell the implementation that we're building the actual implementation12// (and not testing it)13#define BUILDING_CXA_GUARD14#include "cxa_guard_impl.h"1516/*17This implementation must be careful to not call code external to this file18which will turn around and try to call __cxa_guard_acquire reentrantly.19For this reason, the headers of this file are as restricted as possible.20Previous implementations of this code for __APPLE__ have used21std::__libcpp_mutex_lock and the abort_message utility without problem. This22implementation also uses std::__libcpp_condvar_wait which has tested23to not be a problem.24*/2526namespace __cxxabiv1 {2728#if defined(_LIBCXXABI_GUARD_ABI_ARM)29using guard_type = uint32_t;30#else31using guard_type = uint64_t;32#endif3334extern "C"35{36_LIBCXXABI_FUNC_VIS int __cxa_guard_acquire(guard_type* raw_guard_object) {37SelectedImplementation imp(raw_guard_object);38return static_cast<int>(imp.cxa_guard_acquire());39}4041_LIBCXXABI_FUNC_VIS void __cxa_guard_release(guard_type *raw_guard_object) {42SelectedImplementation imp(raw_guard_object);43imp.cxa_guard_release();44}4546_LIBCXXABI_FUNC_VIS void __cxa_guard_abort(guard_type *raw_guard_object) {47SelectedImplementation imp(raw_guard_object);48imp.cxa_guard_abort();49}50} // extern "C"5152} // __cxxabiv1535455