diff options
author | Shanqing Cai <cais@google.com> | 2018-09-07 06:29:38 -0700 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2018-09-07 06:33:08 -0700 |
commit | 4588361b6a5b48aad1ead88755d2afef38605af5 (patch) | |
tree | 76ccb2537c192445108dca445cb6a820fcb73a99 /tensorflow/core/debug/debug_io_utils.cc | |
parent | 40ec9e8e740feec53e9a096da7079bbc9e392604 (diff) |
tfdbg: adjust the scope of mutex for keeping track of disk usage
PiperOrigin-RevId: 211966207
Diffstat (limited to 'tensorflow/core/debug/debug_io_utils.cc')
-rw-r--r-- | tensorflow/core/debug/debug_io_utils.cc | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tensorflow/core/debug/debug_io_utils.cc b/tensorflow/core/debug/debug_io_utils.cc index 38863db1cc..6994dec3b5 100644 --- a/tensorflow/core/debug/debug_io_utils.cc +++ b/tensorflow/core/debug/debug_io_utils.cc @@ -693,6 +693,7 @@ uint64 DebugFileIO::diskBytesUsed = 0; mutex DebugFileIO::bytes_mu(LINKER_INITIALIZED); bool DebugFileIO::requestDiskByteUsage(uint64 bytes) { + mutex_lock l(bytes_mu); if (globalDiskBytesLimit == 0) { const char* env_tfdbg_disk_bytes_limit = getenv("TFDBG_DISK_BYTES_LIMIT"); if (env_tfdbg_disk_bytes_limit == nullptr || @@ -707,7 +708,6 @@ bool DebugFileIO::requestDiskByteUsage(uint64 bytes) { if (bytes == 0) { return true; } - mutex_lock l(bytes_mu); if (diskBytesUsed + bytes < globalDiskBytesLimit) { diskBytesUsed += bytes; return true; |