summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederic Riss <friss@apple.com>2019-05-22 21:58:52 +0000
committerFrederic Riss <friss@apple.com>2019-05-22 21:58:52 +0000
commitbb2b52769b403f3ab56a76baeee330382c46a3dc (patch)
tree89bdc031bdc26a603fa948f53e38df75af94841e
parentdd0fe187ab8f7d69acfe8b6b0b678e966c4244bc (diff)
downloadbcm5719-llvm-bb2b52769b403f3ab56a76baeee330382c46a3dc.tar.gz
bcm5719-llvm-bb2b52769b403f3ab56a76baeee330382c46a3dc.zip
Actaully lock accesses to OptionValueFileSpecList objects
The patch in r359029 missed a few accessors and mutators. This patch also changes the lock to a recursive one as OptionValueFileSpecList::Clear() can be invoked from some of the other methods. llvm-svn: 361440
-rw-r--r--lldb/include/lldb/Interpreter/OptionValueFileSpecList.h9
-rw-r--r--lldb/source/Interpreter/OptionValueFileSpecLIst.cpp4
2 files changed, 8 insertions, 5 deletions
diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
index ed790022ec7..5607437fd0d 100644
--- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
+++ b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h
@@ -40,6 +40,7 @@ public:
VarSetOperationType = eVarSetOperationAssign) = delete;
bool Clear() override {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
m_current_value.Clear();
m_value_was_set = false;
return true;
@@ -52,22 +53,22 @@ public:
// Subclass specific functions
FileSpecList GetCurrentValue() const {
- std::lock_guard<std::mutex> lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
return m_current_value;
}
void SetCurrentValue(const FileSpecList &value) {
- std::lock_guard<std::mutex> lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
m_current_value = value;
}
void AppendCurrentValue(const FileSpec &value) {
- std::lock_guard<std::mutex> lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
m_current_value.Append(value);
}
protected:
- mutable std::mutex m_mutex;
+ mutable std::recursive_mutex m_mutex;
FileSpecList m_current_value;
};
diff --git a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
index 778d8e55a61..a95188870f0 100644
--- a/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
+++ b/lldb/source/Interpreter/OptionValueFileSpecLIst.cpp
@@ -17,6 +17,7 @@ using namespace lldb_private;
void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
Stream &strm, uint32_t dump_mask) {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
if (dump_mask & eDumpOptionType)
strm.Printf("(%s)", GetTypeAsCString());
if (dump_mask & eDumpOptionValue) {
@@ -43,6 +44,7 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx,
Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
VarSetOperationType op) {
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
Status error;
Args args(value.str());
const size_t argc = args.GetArgumentCount();
@@ -163,6 +165,6 @@ Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value,
}
lldb::OptionValueSP OptionValueFileSpecList::DeepCopy() const {
- std::lock_guard<std::mutex> lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> lock(m_mutex);
return OptionValueSP(new OptionValueFileSpecList(m_current_value));
}
OpenPOWER on IntegriCloud