Merge pull request #19017 from veblush/fork-tsan

Made Fork.support_enabled_ atomic
pull/18897/head
Esun Kim 6 years ago committed by GitHub
commit 987cd3d5ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/core/lib/gprpp/fork.cc
  2. 6
      src/core/lib/gprpp/fork.h

@ -243,7 +243,7 @@ void Fork::AwaitThreads() {
internal::ExecCtxState* Fork::exec_ctx_state_ = nullptr;
internal::ThreadState* Fork::thread_state_ = nullptr;
bool Fork::support_enabled_ = false;
std::atomic<bool> Fork::support_enabled_;
bool Fork::override_enabled_ = false;
Fork::child_postfork_func Fork::reset_child_polling_engine_ = nullptr;
} // namespace grpc_core

@ -19,6 +19,10 @@
#ifndef GRPC_CORE_LIB_GPRPP_FORK_H
#define GRPC_CORE_LIB_GPRPP_FORK_H
#include <grpc/support/port_platform.h>
#include <atomic>
/*
* NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK
* AROUND VERY SPECIFIC USE CASES.
@ -78,7 +82,7 @@ class Fork {
private:
static internal::ExecCtxState* exec_ctx_state_;
static internal::ThreadState* thread_state_;
static bool support_enabled_;
static std::atomic<bool> support_enabled_;
static bool override_enabled_;
static child_postfork_func reset_child_polling_engine_;
};

Loading…
Cancel
Save