[cpu-profiler] Use compare_exchange_strong in DoSample
This changes the compare/exchange operation to the 'strong' one which avoids potential spurious failures. These failures would be hidden by the loop in AtomicGuard - except that we only ever call compare_exchange_weak once when is_blocking is false. See the linked bug for more info. Bug: v8:8649 Change-Id: I94ebe04e86f4676d2b7404d833157f61d5df8a59 Reviewed-on: https://chromium-review.googlesource.com/c/1418190 Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Alexei Filippov <alph@chromium.org> Commit-Queue: Peter Marshall <petermarshall@chromium.org> Cr-Commit-Position: refs/heads/master@{#58909}
This commit is contained in:
parent
babdc422e5
commit
4b90359c28
@ -184,7 +184,9 @@ class AtomicGuard {
|
||||
: atomic_(atomic), is_success_(false) {
|
||||
do {
|
||||
bool expected = false;
|
||||
is_success_ = atomic->compare_exchange_weak(expected, true);
|
||||
// We have to use the strong version here for the case where is_blocking
|
||||
// is false, and we will only attempt the exchange once.
|
||||
is_success_ = atomic->compare_exchange_strong(expected, true);
|
||||
} while (is_blocking && !is_success_);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user