From 476c7efc181b58e608d2953a6307e1b0c2a164a1 Mon Sep 17 00:00:00 2001 From: MediaPipe Team Date: Wed, 19 Apr 2023 13:24:47 -0700 Subject: [PATCH] Remove uses of ATOMIC_VAR_INIT ATOMIC_VAR_INIT has a trivial definition `#define ATOMIC_VAR_INIT(value) (value)`, is deprecated in C17/C++20, and will be removed in newer standards in newer GCC/Clang (e.g. https://reviews.llvm.org/D144196). PiperOrigin-RevId: 525534393 --- mediapipe/framework/scheduler.h | 2 +- mediapipe/gpu/gl_context.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mediapipe/framework/scheduler.h b/mediapipe/framework/scheduler.h index b59467b9f..8a6d079e3 100644 --- a/mediapipe/framework/scheduler.h +++ b/mediapipe/framework/scheduler.h @@ -310,7 +310,7 @@ class Scheduler { absl::Mutex state_mutex_; // Current state of the scheduler. - std::atomic state_ = ATOMIC_VAR_INIT(STATE_NOT_STARTED); + std::atomic state_ = STATE_NOT_STARTED; // True if all graph input streams are closed. bool graph_input_streams_closed_ ABSL_GUARDED_BY(state_mutex_) = false; diff --git a/mediapipe/gpu/gl_context.h b/mediapipe/gpu/gl_context.h index 4f2390404..fba0267a8 100644 --- a/mediapipe/gpu/gl_context.h +++ b/mediapipe/gpu/gl_context.h @@ -454,8 +454,8 @@ class GlContext : public std::enable_shared_from_this { // Number of glFinish calls completed on the GL thread. // Changes should be guarded by mutex_. However, we use simple atomic // loads for efficiency on the fast path. - std::atomic gl_finish_count_ = ATOMIC_VAR_INIT(0); - std::atomic gl_finish_count_target_ = ATOMIC_VAR_INIT(0); + std::atomic gl_finish_count_ = 0; + std::atomic gl_finish_count_target_ = 0; GlContext* context_waiting_on_ ABSL_GUARDED_BY(mutex_) = nullptr;