[Lldb-commits] [lldb] r209563 - Add a lock ivar to the Platform so that multiple Targets
Jason Molenda
jmolenda at apple.com
Fri May 23 16:11:27 PDT 2014
Author: jmolenda
Date: Fri May 23 18:11:27 2014
New Revision: 209563
URL: http://llvm.org/viewvc/llvm-project?rev=209563&view=rev
Log:
Add a lock ivar to the Platform so that multiple Targets
trying to populate the list of trap handler names at
the same time don't conflict with one another.
<rdar://problem/17011969>
Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=209563&r1=209562&r2=209563&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Fri May 23 18:11:27 2014
@@ -892,6 +892,7 @@ namespace lldb_private {
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
bool m_calculated_trap_handlers;
+ Mutex m_trap_handler_mutex;
//------------------------------------------------------------------
/// Ask the Platform subclass to fill in the list of trap handler names
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=209563&r1=209562&r2=209563&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Fri May 23 18:11:27 2014
@@ -257,7 +257,8 @@ Platform::Platform (bool is_host) :
m_ssh_opts (),
m_ignores_remote_hostname (false),
m_trap_handlers(),
- m_calculated_trap_handlers (false)
+ m_calculated_trap_handlers (false),
+ m_trap_handler_mutex()
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
@@ -1398,8 +1399,12 @@ Platform::GetTrapHandlerSymbolNames ()
{
if (!m_calculated_trap_handlers)
{
- CalculateTrapHandlerSymbolNames();
- m_calculated_trap_handlers = true;
+ Mutex::Locker locker (m_trap_handler_mutex);
+ if (!m_calculated_trap_handlers)
+ {
+ CalculateTrapHandlerSymbolNames();
+ m_calculated_trap_handlers = true;
+ }
}
return m_trap_handlers;
}
More information about the lldb-commits
mailing list