25 #ifndef ABSL_BASE_CALL_ONCE_H_ 26 #define ABSL_BASE_CALL_ONCE_H_ 31 #include <type_traits> 47 namespace base_internal {
75 template <
typename Callable,
typename... Args>
100 namespace base_internal {
104 template <
typename Callable,
typename... Args>
144 template <
typename Callable,
typename... Args>
150 uint32_t old_control = control->load(std::memory_order_acquire);
155 ABSL_RAW_LOG(FATAL,
"Unexpected value for control word: 0x%lx",
156 static_cast<unsigned long>(old_control));
169 if (control->compare_exchange_strong(old_control,
kOnceRunning,
170 std::memory_order_acquire,
171 std::memory_order_relaxed) ||
175 std::forward<Args>(args)...);
176 old_control = control->load(std::memory_order_relaxed);
188 template <
typename Callable,
typename... Args>
191 uint32_t s = once->load(std::memory_order_acquire);
194 std::forward<Callable>(fn),
195 std::forward<Args>(args)...);
201 template <
typename Callable,
typename... Args>
204 uint32_t s = once->load(std::memory_order_acquire);
208 std::forward<Callable>(fn), std::forward<Args>(args)...);
214 #endif // ABSL_BASE_CALL_ONCE_H_
#define ABSL_RAW_LOG(severity,...)
void CallOnceImpl(std::atomic< uint32_t > *control, base_internal::SchedulingMode scheduling_mode, Callable &&fn, Args &&... args)
void LowLevelCallOnce(absl::once_flag *flag, Callable &&fn, Args &&... args)
#define ABSL_PREDICT_FALSE(x)
uint32_t SpinLockWait(std::atomic< uint32_t > *w, int n, const SpinLockWaitTransition trans[], base_internal::SchedulingMode scheduling_mode)
void call_once(absl::once_flag &flag, Callable &&fn, Args &&... args)
void SpinLockWake(std::atomic< uint32_t > *w, bool all)
static bool DisableRescheduling()
SchedulingHelper(base_internal::SchedulingMode mode)
base_internal::SchedulingMode mode_
std::atomic< uint32_t > * ControlWord(absl::once_flag *flag)
std::atomic< uint32_t > control_
#define ABSL_ARRAYSIZE(array)
InvokeT< F, Args... > Invoke(F &&f, Args &&... args)
static void EnableRescheduling(bool disable_result)