Skip to content

Commit

Permalink
Made Fork.support_enabled_ atomic
Browse files Browse the repository at this point in the history
  • Loading branch information
veblush committed May 13, 2019
1 parent 51360d8 commit 86febe4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/core/lib/gprpp/fork.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 5 additions & 1 deletion src/core/lib/gprpp/fork.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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_;
};
Expand Down

0 comments on commit 86febe4

Please sign in to comment.