diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-18 01:59:10 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2016-05-18 01:59:10 +0000 |
commit | 16ff8604690ea63a3a82dd3b156061afb84dbcf1 (patch) | |
tree | a2d912258ecb0690f4a810ca1e438fc277160326 /lldb/source/Core/Timer.cpp | |
parent | a36a61d46ac3f2ea10e78ac816bca5784bc8ba35 (diff) | |
download | bcm5719-llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.tar.gz bcm5719-llvm-16ff8604690ea63a3a82dd3b156061afb84dbcf1.zip |
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/Core/Timer.cpp')
-rw-r--r-- | lldb/source/Core/Timer.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
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 <algorithm> #include <map> +#include <mutex> #include <vector> -#include <algorithm> #include "lldb/Core/Stream.h" -#include "lldb/Host/Mutex.h" #include "lldb/Host/Host.h" #include <stdio.h> @@ -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<std::mutex> 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<std::mutex> 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<std::mutex> guard(GetCategoryMutex()); TimerCategoryMap &category_map = GetCategoryMap(); std::vector<TimerCategoryMap::const_iterator> sorted_iterators; TimerCategoryMap::const_iterator pos, end = category_map.end(); |