From 16ff8604690ea63a3a82dd3b156061afb84dbcf1 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 18 May 2016 01:59:10 +0000 Subject: 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 --- lldb/source/Core/Timer.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lldb/source/Core/Timer.cpp') diff --git a/lldb/source/Core/Timer.cpp b/lldb/source/Core/Timer.cpp index 73175988753..f4cd33fc3cb 100644 --- a/lldb/source/Core/Timer.cpp +++ b/lldb/source/Core/Timer.cpp @@ -8,12 +8,12 @@ //===----------------------------------------------------------------------===// #include "lldb/Core/Timer.h" +#include #include +#include #include -#include #include "lldb/Core/Stream.h" -#include "lldb/Host/Mutex.h" #include "lldb/Host/Host.h" #include @@ -52,11 +52,10 @@ GetFileMutex() return *g_file_mutex_ptr; } - -static Mutex & +static std::mutex & GetCategoryMutex() { - static Mutex g_category_mutex(Mutex::eMutexTypeNormal); + static std::mutex g_category_mutex; return g_category_mutex; } @@ -169,7 +168,7 @@ Timer::~Timer() } // Keep total results for each category so we can dump results. - Mutex::Locker locker (GetCategoryMutex()); + std::lock_guard guard(GetCategoryMutex()); TimerCategoryMap &category_map = GetCategoryMap(); category_map[m_category] += timer_nsec_uint; } @@ -240,7 +239,7 @@ CategoryMapIteratorSortCriterion (const TimerCategoryMap::const_iterator& lhs, c void Timer::ResetCategoryTimes () { - Mutex::Locker locker (GetCategoryMutex()); + std::lock_guard guard(GetCategoryMutex()); TimerCategoryMap &category_map = GetCategoryMap(); category_map.clear(); } @@ -248,7 +247,7 @@ Timer::ResetCategoryTimes () void Timer::DumpCategoryTimes (Stream *s) { - Mutex::Locker locker (GetCategoryMutex()); + std::lock_guard guard(GetCategoryMutex()); TimerCategoryMap &category_map = GetCategoryMap(); std::vector sorted_iterators; TimerCategoryMap::const_iterator pos, end = category_map.end(); -- cgit v1.2.3