diff options
author | 2023-04-10 23:25:19 +0000 | |
---|---|---|
committer | 2023-08-14 13:47:49 -0700 | |
commit | 2caa640269faabd2455ec29cfe6ad330d442b715 (patch) | |
tree | da8f0aa24a829573c51c4c0abedd9b567586265e /runtime/native/java_lang_Thread.cc | |
parent | 15de3b7e4f69d0d9b7cea3c8f06d6aafad6de0f3 (diff) |
Revert^10 "Thread suspension cleanup and deadlock fix"""
This reverts commit 63af30b8fe8d4e1dc32db4dcb5e5dae1efdc7f31.
master (aosp/2530206) PS1 is identical to aosp/2377951 .
master (aosp/2530206) PS2 is a rebase.
At this point, master branch was replaced by main, and this CL moved.
PS1: Restructure documentation for the IncrementSuspendCount handshake
to install a suspend barrier.
Document a couple of additional mutator lock assumptions.
Add some DCHECKs to check that suspended threads really are
suspended.
Weaken seq_cst memory order in a couple of places where it really
didn't make sense here. Clearly not a correctness fix.
Includes a rebase and merge with aosp/2587606.
PS2: Another rebase.
Fix thumb assembler test to compensate for Thread structure layout
changes.
PS3: Messy rebase, primarily to handle aosp/2670108, which included both
new fixes around this and a few small snippets of this CL.
Call EnsureFlipFunctionStarted without a state-and-flags argument
only when we actually hold the mutator lock, as promised.
PS4: Minor rebase, some lint fixes.
PS5: Another minor lint fix that I had missed in PS4.
PS6: Fix for RunCheckpoint bug introduced around PS3. Fix expectations
in jni_cfi_test to compensate for thread structure layout changes.
PS7: In PS3+, EnsureFlipFunctionStarted could access a destroyed "this"
thread. Fix that, and make the function static to make this
constraint more explicit. (And running a method on a potentially
destroyed object just seemed unclean.)
PS8: Address reviewer comments. The major issue was that we released
the suspend_count_lock too early in FlipThreadRoots, potentially
allowing an intervening SuspendAll to block us. The fix involved
a very minor extention of the mutex API.
PS9: Comment typo fix.
PS10: Address new reviewer comments. Rebase.
MUST_SLEEP for 129_ThreadGetId debug output.
Test: Treehugger.
Bug: 240742796
Bug: 203363895
Bug: 238032384
Bug: 253671779
Bug: 276660630
(and more)
Change-Id: I0f2450e394c03c17eece3698286b2f3e45727967
Diffstat (limited to 'runtime/native/java_lang_Thread.cc')
-rw-r--r-- | runtime/native/java_lang_Thread.cc | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/runtime/native/java_lang_Thread.cc b/runtime/native/java_lang_Thread.cc index 570c554782..fd67a0a7fa 100644 --- a/runtime/native/java_lang_Thread.cc +++ b/runtime/native/java_lang_Thread.cc @@ -147,11 +147,8 @@ static void Thread_setNativeName(JNIEnv* env, jobject peer, jstring java_name) { // thread list lock to avoid this, as setting the thread name causes mutator to lock/unlock // in the DDMS send code. ThreadList* thread_list = Runtime::Current()->GetThreadList(); - bool timed_out; // Take suspend thread lock to avoid races with threads trying to suspend this one. - Thread* thread = thread_list->SuspendThreadByPeer(peer, - SuspendReason::kInternal, - &timed_out); + Thread* thread = thread_list->SuspendThreadByPeer(peer, SuspendReason::kInternal); if (thread != nullptr) { { ScopedObjectAccess soa(env); @@ -159,9 +156,6 @@ static void Thread_setNativeName(JNIEnv* env, jobject peer, jstring java_name) { } bool resumed = thread_list->Resume(thread, SuspendReason::kInternal); DCHECK(resumed); - } else if (timed_out) { - LOG(ERROR) << "Trying to set thread name to '" << name.c_str() << "' failed as the thread " - "failed to suspend within a generous timeout."; } } |