Always check result of Thread::ModifySuspendCount
Ensures that we never ignore the result of ModifySuspendCount so that
we can react if the suspend count is not updated as expected.
This CL does the following:
* Adds __attribute__((warn_unused_result)) on the method to raise an
error at compilation time if the result is ignored.
* Wraps calls with DCHECK where the result used to be ignored.
Bug: 27385848
Test: make -j test-art-host
Test: art/tools/run-jdwp-tests.sh --mode=host --variant=X64
Change-Id: I2d0e1ab7158c70ec8076c8bae6e4b814aee75af6
diff --git a/runtime/thread.cc b/runtime/thread.cc
index 008c388..87697c7 100644
--- a/runtime/thread.cc
+++ b/runtime/thread.cc
@@ -1451,7 +1451,8 @@
MutexLock mu2(self, *Locks::thread_suspend_count_lock_);
DCHECK_NE(GetState(), ThreadState::kRunnable);
- CHECK(ModifySuspendCount(self, -1, nullptr, false));
+ bool updated = ModifySuspendCount(self, -1, nullptr, false);
+ DCHECK(updated);
}
return; // We're done, break out of the loop.