remove use of Mutex in favour of std::{,recursive_}mutex
This is a pretty straightforward first pass over removing a number of uses of
Mutex in favor of std::mutex or std::recursive_mutex. The problem is that there
are interfaces which take Mutex::Locker & to lock internal locks. This patch
cleans up most of the easy cases. The only non-trivial change is in
CommandObjectTarget.cpp where a Mutex::Locker was split into two.
llvm-svn: 269877
diff --git a/lldb/source/DataFormatters/FormatCache.cpp b/lldb/source/DataFormatters/FormatCache.cpp
index fa74940..fc5becb 100644
--- a/lldb/source/DataFormatters/FormatCache.cpp
+++ b/lldb/source/DataFormatters/FormatCache.cpp
@@ -158,11 +158,13 @@
m_validator_sp = validator_sp;
}
-FormatCache::FormatCache () :
-m_map(),
-m_mutex (Mutex::eMutexTypeRecursive)
+FormatCache::FormatCache()
+ : m_map(),
+ m_mutex()
#ifdef LLDB_CONFIGURATION_DEBUG
-,m_cache_hits(0),m_cache_misses(0)
+ ,
+ m_cache_hits(0),
+ m_cache_misses(0)
#endif
{
}
@@ -181,7 +183,7 @@
bool
FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
if (entry.IsFormatCached())
{
@@ -201,7 +203,7 @@
bool
FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
if (entry.IsSummaryCached())
{
@@ -221,7 +223,7 @@
bool
FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
if (entry.IsSyntheticCached())
{
@@ -241,7 +243,7 @@
bool
FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
auto entry = GetEntry(type);
if (entry.IsValidatorCached())
{
@@ -261,35 +263,35 @@
void
FormatCache::SetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetFormat(format_sp);
}
void
FormatCache::SetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summary_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetSummary(summary_sp);
}
void
FormatCache::SetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& synthetic_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetSynthetic(synthetic_sp);
}
void
FormatCache::SetValidator (const ConstString& type,lldb::TypeValidatorImplSP& validator_sp)
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
GetEntry(type).SetValidator(validator_sp);
}
void
FormatCache::Clear ()
{
- Mutex::Locker lock(m_mutex);
+ std::lock_guard<std::recursive_mutex> guard(m_mutex);
m_map.clear();
}