mirror of
https://github.com/chromium/crashpad.git
synced 2025-03-09 14:06:33 +00:00
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:
parent
da3384a708
commit
70d10eb629
@ -96,7 +96,7 @@ CRITICAL_SECTION g_critical_section_with_debug_info;
|
|||||||
|
|
||||||
void SetHandlerStartupState(StartupState state) {
|
void SetHandlerStartupState(StartupState state) {
|
||||||
DCHECK(state == StartupState::kSucceeded || state == StartupState::kFailed);
|
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));
|
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.
|
// Wait until we know the handler has either succeeded or failed to start.
|
||||||
base::subtle::AtomicWord startup_state;
|
base::subtle::AtomicWord startup_state;
|
||||||
while (
|
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)) {
|
static_cast<int>(StartupState::kNotReady)) {
|
||||||
Sleep(1);
|
Sleep(1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user