diff options
Diffstat (limited to 'source/DataFormatters/FormatCache.cpp')
| -rw-r--r-- | source/DataFormatters/FormatCache.cpp | 30 | 
1 files changed, 16 insertions, 14 deletions
diff --git a/source/DataFormatters/FormatCache.cpp b/source/DataFormatters/FormatCache.cpp index 748c6d80fbd2..fc5becbf200d 100644 --- a/source/DataFormatters/FormatCache.cpp +++ b/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,9 +183,9 @@ 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.IsSummaryCached()) +    if (entry.IsFormatCached())      {  #ifdef LLDB_CONFIGURATION_DEBUG          m_cache_hits++; @@ -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();  }  | 
