aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
diff options
context:
space:
mode:
authorTodd Fiala <todd.fiala@gmail.com>2014-09-15 20:07:33 +0000
committerTodd Fiala <todd.fiala@gmail.com>2014-09-15 20:07:33 +0000
commit7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66 (patch)
tree03189805e0fb8976aaca4c1acd461075b0a6aff5 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
parent52550349827a1b836de87ec83689fa89b1d208f0 (diff)
downloadllvm-7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66.zip
llvm-7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66.tar.gz
llvm-7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66.tar.bz2
use std::atomic<> to protect variables being accessed by multiple threads
There are several places where multiple threads are accessing the same variables simultaneously without any kind of protection. I propose using std::atomic<> to make it safer. I did a special build of lldb, using the google tool 'thread sanitizer' which identified many cases of multiple threads accessing the same memory. std::atomic is low overhead and does not use any locks for simple types such as int/bool. See http://reviews.llvm.org/D5302 for more details. Change by Shawn Best. llvm-svn: 217818
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index 5e1365c..d9388d5 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -328,7 +328,7 @@ protected:
lldb_private::Flags m_flags; // Process specific flags (see eFlags enums)
GDBRemoteCommunicationClient m_gdb_comm;
- lldb::pid_t m_debugserver_pid;
+ std::atomic<lldb::pid_t> m_debugserver_pid;
StringExtractorGDBRemote m_last_stop_packet;
lldb_private::Mutex m_last_stop_packet_mutex;
GDBRemoteDynamicRegisterInfo m_register_info;