<div dir="ltr">Seems like this class would be a good candidate for using an RWMutex. Any reason you can think of why that wouldn't work?</div><br><div class="gmail_quote"><div dir="ltr">On Tue, Nov 3, 2015 at 5:41 PM Jim Ingham via lldb-commits <<a href="mailto:lldb-commits@lists.llvm.org">lldb-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: jingham<br>
Date: Tue Nov 3 19:39:05 2015<br>
New Revision: 252031<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=252031&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=252031&view=rev</a><br>
Log:<br>
Add a few useful methods to ThreadSafeDense{Map,Set}. Not used yet.<br>
<br>
Modified:<br>
lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h<br>
lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h<br>
<br>
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h?rev=252031&r1=252030&r2=252031&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h?rev=252031&r1=252030&r2=252031&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h (original)<br>
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseMap.h Tue Nov 3 19:39:05 2015<br>
@@ -54,7 +54,27 @@ public:<br>
Mutex::Locker locker(m_mutex);<br>
return m_map.lookup(k);<br>
}<br>
-<br>
+<br>
+ bool<br>
+ Lookup (_KeyType k,<br>
+ _ValueType& v)<br>
+ {<br>
+ Mutex::Locker locker(m_mutex);<br>
+ auto iter = m_map.find(k),<br>
+ end = m_map.end();<br>
+ if (iter == end)<br>
+ return false;<br>
+ v = iter->second;<br>
+ return true;<br>
+ }<br>
+<br>
+ void<br>
+ Clear ()<br>
+ {<br>
+ Mutex::Locker locker(m_mutex);<br>
+ m_map.clear();<br>
+ }<br>
+<br>
protected:<br>
LLVMMapType m_map;<br>
Mutex m_mutex;<br>
<br>
Modified: lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h?rev=252031&r1=252030&r2=252031&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h?rev=252031&r1=252030&r2=252031&view=diff</a><br>
==============================================================================<br>
--- lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h (original)<br>
+++ lldb/trunk/include/lldb/Core/ThreadSafeDenseSet.h Tue Nov 3 19:39:05 2015<br>
@@ -55,6 +55,13 @@ namespace lldb_private {<br>
return (m_set.count(e) > 0);<br>
}<br>
<br>
+ void<br>
+ Clear ()<br>
+ {<br>
+ Mutex::Locker locker(m_mutex);<br>
+ m_set.clear();<br>
+ }<br>
+<br>
protected:<br>
LLVMSetType m_set;<br>
Mutex m_mutex;<br>
<br>
<br>
_______________________________________________<br>
lldb-commits mailing list<br>
<a href="mailto:lldb-commits@lists.llvm.org" target="_blank">lldb-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits</a><br>
</blockquote></div>