mirror of
https://github.com/intel/llvm.git
synced 2026-01-19 01:15:50 +08:00
Add a few useful methods to ThreadSafeDense{Map,Set}. Not used yet.
llvm-svn: 252031
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user