Improve suspension timeout diagnostic and fix race
Fix a data race on state_and_flags. Since the access was volatile
and there are system calls in the loop, this is extremely unlikey
to have casused the bug here, but ...
So, assuming this is still broken, produce more informative
output once we time out.
Remove unused argument from SuspendThreadByPeer(). It made the
logic more complicated and made it harder to reason about
correctness.
Remove dead code after LOG(FATAL, ...)
Bug: 181778559
Test: TreeHugger, temporarily paste log message into hotter path.
Change-Id: I6f3455925b3a3f4726a870150aeb54ea60a38d67
diff --git a/test/2011-stack-walk-concurrent-instrument/stack_walk_concurrent.cc b/test/2011-stack-walk-concurrent-instrument/stack_walk_concurrent.cc
index a185446..a10fe2e 100644
--- a/test/2011-stack-walk-concurrent-instrument/stack_walk_concurrent.cc
+++ b/test/2011-stack-walk-concurrent-instrument/stack_walk_concurrent.cc
@@ -81,7 +81,7 @@
}
bool timed_out = false;
Thread* other = Runtime::Current()->GetThreadList()->SuspendThreadByPeer(
- target, true, SuspendReason::kInternal, &timed_out);
+ target, SuspendReason::kInternal, &timed_out);
CHECK(!timed_out);
CHECK(other != nullptr);
ScopedSuspendAll ssa(__FUNCTION__);