aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/core/debug
diff options
context:
space:
mode:
authorGravatar Shanqing Cai <cais@google.com>2017-08-17 09:59:45 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-08-17 10:03:36 -0700
commitc1f69be22e151e2d051f41fccf436767eee4a26a (patch)
tree0dd43cc4f46c7dda7742db9ae9f19196e1108e24 /tensorflow/core/debug
parent055375c0c2dba975145d5f9dba99db1400483eaa (diff)
tfdbg core: fix data race
PiperOrigin-RevId: 165591428
Diffstat (limited to 'tensorflow/core/debug')
-rw-r--r--tensorflow/core/debug/debug_io_utils.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/tensorflow/core/debug/debug_io_utils.cc b/tensorflow/core/debug/debug_io_utils.cc
index 2c0284a6e0..4f52cb0b4d 100644
--- a/tensorflow/core/debug/debug_io_utils.cc
+++ b/tensorflow/core/debug/debug_io_utils.cc
@@ -927,8 +927,11 @@ DebugGrpcIO::GetEnabledDebugOpStates() {
// static
DebugGrpcIO::DebugNodeName2State* DebugGrpcIO::GetEnabledDebugOpStatesAtUrl(
const string& grpc_debug_url) {
+ static mutex* debug_ops_state_mu = new mutex();
std::unordered_map<string, DebugNodeName2State>* states =
GetEnabledDebugOpStates();
+
+ mutex_lock l(*debug_ops_state_mu);
if (states->find(grpc_debug_url) == states->end()) {
DebugNodeName2State url_enabled_debug_op_states;
(*states)[grpc_debug_url] = url_enabled_debug_op_states;