Go to the documentation of this file.
25 #ifndef ABSL_BASE_CALL_ONCE_H_
26 #define ABSL_BASE_CALL_ONCE_H_
31 #include <type_traits>
34 #include "absl/base/internal/invoke.h"
35 #include "absl/base/internal/low_level_scheduling.h"
36 #include "absl/base/internal/raw_logging.h"
37 #include "absl/base/internal/scheduling_mode.h"
38 #include "absl/base/internal/spinlock_wait.h"
39 #include "absl/base/macros.h"
40 #include "absl/base/optimization.h"
41 #include "absl/base/port.h"
48 namespace base_internal {
76 template <
typename Callable,
typename...
Args>
101 namespace base_internal {
105 template <
typename Callable,
typename...
Args>
145 template <
typename Callable,
typename...
Args>
152 uint32_t old_control = control->load(std::memory_order_relaxed);
158 static_cast<unsigned long>(old_control));
174 if (control->compare_exchange_strong(old_control,
kOnceRunning,
175 std::memory_order_relaxed) ||
179 std::forward<Args>(
args)...);
189 return &
flag->control_;
192 template <
typename Callable,
typename...
Args>
198 std::forward<Callable>(
fn),
199 std::forward<Args>(
args)...);
205 template <
typename Callable,
typename...
Args>
212 std::forward<Callable>(
fn), std::forward<Args>(
args)...);
219 #endif // ABSL_BASE_CALL_ONCE_H_
#define ABSL_PREDICT_FALSE(x)
std::atomic< uint32_t > * ControlWord(absl::once_flag *flag)
once_flag & operator=(const once_flag &)=delete
#define ABSL_ARRAYSIZE(array)
#define ABSL_NAMESPACE_END
#define ABSL_ATTRIBUTE_NOINLINE
void call_once(absl::once_flag &flag, Callable &&fn, Args &&... args)
std::atomic< uint32_t > control_
static void EnableRescheduling(bool disable_result)
#define ABSL_NAMESPACE_BEGIN
base_internal::SchedulingMode mode_
@ SCHEDULE_COOPERATIVE_AND_KERNEL
void LowLevelCallOnce(absl::once_flag *flag, Callable &&fn, Args &&... args)
ABSL_ATTRIBUTE_NOINLINE void CallOnceImpl(std::atomic< uint32_t > *control, base_internal::SchedulingMode scheduling_mode, Callable &&fn, Args &&... args)
void SpinLockWake(std::atomic< uint32_t > *w, bool all)
SchedulingHelper(base_internal::SchedulingMode mode)
#define ABSL_RAW_LOG(severity,...)
static bool DisableRescheduling()
invoke_result_t< F, Args... > invoke(F &&f, Args &&... args)
uint32_t SpinLockWait(std::atomic< uint32_t > *w, int n, const SpinLockWaitTransition trans[], base_internal::SchedulingMode scheduling_mode)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:57:51