diff options
| author | Todd Fiala <todd.fiala@gmail.com> | 2014-09-15 20:07:33 +0000 |
|---|---|---|
| committer | Todd Fiala <todd.fiala@gmail.com> | 2014-09-15 20:07:33 +0000 |
| commit | 7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66 (patch) | |
| tree | 03189805e0fb8976aaca4c1acd461075b0a6aff5 /lldb/source/Plugins/Process/POSIX | |
| parent | 52550349827a1b836de87ec83689fa89b1d208f0 (diff) | |
| download | bcm5719-llvm-7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66.tar.gz bcm5719-llvm-7b0917a0c5a7b015e521c2ea719fdddc7f7b0d66.zip | |
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/POSIX')
| -rw-r--r-- | lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp index c930a1881cd..d0cc9cd0a2e 100644 --- a/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp +++ b/lldb/source/Plugins/Process/POSIX/ProcessPOSIX.cpp @@ -434,8 +434,7 @@ ProcessPOSIX::SendMessage(const ProcessMessage &message) // FIXME: I'm not sure we need to do this. if (message.GetTID() == GetID()) { - m_exit_status = message.GetExitStatus(); - SetExitStatus(m_exit_status, NULL); + SetExitStatus(message.GetExitStatus(), NULL); } else if (!IsAThreadRunning()) SetPrivateState(eStateStopped); |

