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 <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
This commit is contained in:
Venkatesh Srinivas 2019-08-07 11:02:57 -04:00 committed by Commit Bot
parent da3384a708
commit 70d10eb629

View File

@ -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<base::subtle::AtomicWord>(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<int>(StartupState::kNotReady)) {
Sleep(1);
}