Make ExceptionHandlerServer::keep_running_ atomic

ExceptionHandlerServer::keep_running_ is used to implement
synchronization across threads (e.g. ExceptionHandlerServer::Stop)
but the variable is not atomic. This causes TSan failures and could
also lead to incorrect compiler optimizations.

Bug: crashpad:304
Change-Id: I3cf5c083d70b6be903e16dbb6feb8fecea2aa1b8
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1706793
Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
This commit is contained in:
Vlad Tsyrklevich 2019-07-17 08:44:11 -07:00 committed by Commit Bot
parent a079d8b15b
commit 4f0a0f5d36

View File

@ -18,6 +18,7 @@
#include <stdint.h>
#include <sys/socket.h>
#include <atomic>
#include <memory>
#include <unordered_map>
@ -181,7 +182,7 @@ class ExceptionHandlerServer {
std::unique_ptr<PtraceStrategyDecider> strategy_decider_;
Delegate* delegate_;
ScopedFileHandle pollfd_;
bool keep_running_;
std::atomic<bool> keep_running_;
InitializationStateDcheck initialized_;
DISALLOW_COPY_AND_ASSIGN(ExceptionHandlerServer);