File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -1114,9 +1114,15 @@ bool MatrixWorkspace::isHistogramDataByIndex(const std::size_t index) const {
11141114}
11151115
11161116bool MatrixWorkspace::setCommonBinsFlag (const bool value) const {
1117+ // check valid flag before acquiring lock
11171118 if (m_isCommonBinsFlagValid.load (std::memory_order_acquire))
11181119 return m_isCommonBinsFlag.load (std::memory_order_relaxed);
11191120 std::lock_guard<std::mutex> lock{m_isCommonBinsMutex};
1121+
1122+ // after acquiring lock, check valid flag again
1123+ if (m_isCommonBinsFlagValid.load (std::memory_order_acquire))
1124+ return m_isCommonBinsFlag.load (std::memory_order_relaxed);
1125+
11201126 m_isCommonBinsFlag.store (value, std::memory_order_relaxed);
11211127 m_isCommonBinsFlagValid.store (true , std::memory_order_release);
11221128 return value;
You can’t perform that action at this time.
0 commit comments