From 70d10eb6296bd7bf93d536bf8efc3e51a8683f75 Mon Sep 17 00:00:00 2001 From: Venkatesh Srinivas Date: Wed, 7 Aug 2019 11:02:57 -0400 Subject: [PATCH] client_win: Switch Release Load/Acq Store->Rel Store/Acq Load client_win used a non-standard/poorly defined "Acquire Store" and "Release Load" pair to have handlers notify when they changed state and to wait for handlers to change state. Acquire stores and Release Loads are not expressable in C++11 atomics and even at face value did not provide useful semantics here (code waiting for a handler to change state wants to see the handler's stores.) Change-Id: I8d08d0d7baf9979406557ec2b90fea4cd51892bc Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1741716 Reviewed-by: Mark Mentovai Commit-Queue: Mark Mentovai --- client/crashpad_client_win.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/crashpad_client_win.cc b/client/crashpad_client_win.cc index 143dc4f1..c1c3ff14 100644 --- a/client/crashpad_client_win.cc +++ b/client/crashpad_client_win.cc @@ -96,7 +96,7 @@ CRITICAL_SECTION g_critical_section_with_debug_info; void SetHandlerStartupState(StartupState state) { DCHECK(state == StartupState::kSucceeded || state == StartupState::kFailed); - base::subtle::Acquire_Store(&g_handler_startup_state, + base::subtle::Release_Store(&g_handler_startup_state, static_cast(state)); } @@ -104,7 +104,7 @@ StartupState BlockUntilHandlerStartedOrFailed() { // Wait until we know the handler has either succeeded or failed to start. base::subtle::AtomicWord startup_state; while ( - (startup_state = base::subtle::Release_Load(&g_handler_startup_state)) == + (startup_state = base::subtle::Acquire_Load(&g_handler_startup_state)) == static_cast(StartupState::kNotReady)) { Sleep(1); }