aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/c/python_api.cc
diff options
context:
space:
mode:
authorGravatar Skye Wanderman-Milne <skyewm@google.com>2018-03-12 11:02:29 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-03-12 11:06:44 -0700
commit1d6a57edc0be0dcc0c92eb2610b88420a7b7be51 (patch)
treebeec27e175dc508ad0340d57b89676a805e5c79d /tensorflow/c/python_api.cc
parent89177f289e9467e04b205a1a3e705ad67d9854d2 (diff)
Fix race in C API.
RecordMutation could race with ExtendSessionGraphHelper, which would release the graph lock and only keep the session lock when extending the session. Also makes sure thread annotations are on declarations, not definitions (otherwise they have no effect). PiperOrigin-RevId: 188747158
Diffstat (limited to 'tensorflow/c/python_api.cc')
-rw-r--r--tensorflow/c/python_api.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/tensorflow/c/python_api.cc b/tensorflow/c/python_api.cc
index 26683f50ec..cd604538f1 100644
--- a/tensorflow/c/python_api.cc
+++ b/tensorflow/c/python_api.cc
@@ -105,9 +105,8 @@ void SetRequireShapeInferenceFns(TF_Graph* graph, bool require) {
}
void ExtendSession(TF_Session* session, TF_Status* status) {
- mutex_lock l(session->mu);
- session->extend_before_run = false;
ExtendSessionGraphHelper(session, status);
+ session->extend_before_run = false;
}
} // namespace tensorflow