chromium/third_party/libc++/src/src/call_once.cpp

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include <__mutex/once_flag.h>
#include <__utility/exception_guard.h>

#ifndef _LIBCPP_HAS_NO_THREADS
#  include <__thread/support.h>
#endif

#include "include/atomic_support.h"

_LIBCPP_BEGIN_NAMESPACE_STD

// If dispatch_once_f ever handles C++ exceptions, and if one can get to it
// without illegal macros (unexpected macros not beginning with _UpperCase or
// __lowercase), and if it stops spinning waiting threads, then call_once should
// call into dispatch_once_f instead of here. Relevant radar this code needs to
// keep in sync with:  7741191.

#ifndef _LIBCPP_HAS_NO_THREADS
static constinit __libcpp_mutex_t mut  =;
static constinit __libcpp_condvar_t cv =;
#endif

void __call_once(volatile once_flag::_State_type& flag, void* arg, void (*func)(void*)) {}

_LIBCPP_END_NAMESPACE_STD