aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/DataFormatters/FormatCache.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-05-18 01:59:10 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-05-18 01:59:10 +0000
commit16ff8604690ea63a3a82dd3b156061afb84dbcf1 (patch)
treea2d912258ecb0690f4a810ca1e438fc277160326 /lldb/source/DataFormatters/FormatCache.cpp
parenta36a61d46ac3f2ea10e78ac816bca5784bc8ba35 (diff)
downloadllvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.zip
llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.tar.gz
llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.tar.bz2
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
Diffstat (limited to 'lldb/source/DataFormatters/FormatCache.cpp')
-rw-r--r--lldb/source/DataFormatters/FormatCache.cpp28
1 files changed, 15 insertions, 13 deletions
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 @@ FormatCache::Entry::SetValidator (lldb::TypeValidatorImplSP validator_sp)
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 @@ FormatCache::GetEntry (const ConstString& type)
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 @@ FormatCache::GetFormat (const ConstString& type,lldb::TypeFormatImplSP& format_s
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 @@ FormatCache::GetSummary (const ConstString& type,lldb::TypeSummaryImplSP& summar
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 @@ FormatCache::GetSynthetic (const ConstString& type,lldb::SyntheticChildrenSP& sy
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 @@ FormatCache::GetValidator (const ConstString& type,lldb::TypeValidatorImplSP& va
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();
}