summaryrefslogtreecommitdiff
path: root/openjdkjvmti/alloc_manager.cc
diff options
context:
space:
mode:
author Alex Light <allight@google.com> 2019-12-17 16:45:49 -0800
committer Treehugger Robot <treehugger-gerrit@google.com> 2019-12-18 17:52:56 +0000
commit7a6b966d348ee780922e04a8304d3dcc9e297517 (patch)
treed2267f6e09c0f1d92dbf527eeb499a37044e9be6 /openjdkjvmti/alloc_manager.cc
parent96cbde8221731ac10bf6811ed4c415bbea45656b (diff)
Fix reversed compare_exchange check.
We were incorrectly stopping a retry-loop when compare_exchange_strong returned true instead of false. This could lead to races if multiple threads tried to pause allocations simultaneously. Test: ./test.py --host Bug: 146436130 Change-Id: I46ab86010d24148d640af0c51a5268b3eef0d300
Diffstat (limited to 'openjdkjvmti/alloc_manager.cc')
-rw-r--r--openjdkjvmti/alloc_manager.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/openjdkjvmti/alloc_manager.cc b/openjdkjvmti/alloc_manager.cc
index f5e4af60c2..76605399b2 100644
--- a/openjdkjvmti/alloc_manager.cc
+++ b/openjdkjvmti/alloc_manager.cc
@@ -165,7 +165,7 @@ void AllocationManager::PauseAllocations(art::Thread* self) {
IncrListenerInstall(self);
do {
PauseForAllocation(self, []() { return "request to pause allocations on other threads"; });
- } while (allocations_paused_thread_.compare_exchange_strong(
+ } while (!allocations_paused_thread_.compare_exchange_strong(
null_thr, self, std::memory_order_seq_cst));
// Make sure everything else can see this and isn't in the middle of final allocation.
// Force every thread to either be suspended or pass through a barrier.