[Lldb-commits] [lldb] r252031 - Add a few useful methods to ThreadSafeDense{Map, Set}. Not used yet.
Jim Ingham via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 3 17:39:05 PST 2015
Author: jingham
Date: Tue Nov 3 19:39:05 2015
New Revision: 252031
URL: http://llvm.org/viewvc/llvm-project?rev=252031&view=rev
Log:
Add a few useful methods to ThreadSafeDense{Map,Set}. Not used yet.
Modified:
lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h
lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h?rev=252031&r1=252030&r2=252031&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h (original)
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h Tue Nov 3 19:39:05 2015
@@ -54,7 +54,27 @@ public:
Mutex::Locker locker(m_mutex);
return m_map.lookup(k);
}
-
+
+ bool
+ Lookup (_KeyType k,
+ _ValueType& v)
+ {
+ Mutex::Locker locker(m_mutex);
+ auto iter = m_map.find(k),
+ end = m_map.end();
+ if (iter == end)
+ return false;
+ v = iter->second;
+ return true;
+ }
+
+ void
+ Clear ()
+ {
+ Mutex::Locker locker(m_mutex);
+ m_map.clear();
+ }
+
protected:
LLVMMapType m_map;
Mutex m_mutex;
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h?rev=252031&r1=252030&r2=252031&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h (original)
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h Tue Nov 3 19:39:05 2015
@@ -55,6 +55,13 @@ namespace lldb_private {
return (m_set.count(e) > 0);
}
+ void
+ Clear ()
+ {
+ Mutex::Locker locker(m_mutex);
+ m_set.clear();
+ }
+
protected:
LLVMSetType m_set;
Mutex m_mutex;
More information about the lldb-commits
mailing list