Revert "Enable thread exit checks for bionic" This reverts commit 480263c191e49f9f766c643a9c295e9c42b799aa. Reason for revert: DroidMonitor: Potential culprit for http://b/406573423 - verifying through ABTD before revert submission. This is part of the standard investigation process, and does not mean your CL will be reverted. Change-Id: I1796db379c64218505ee967006f8007044c3a8e0
diff --git a/runtime/thread.cc b/runtime/thread.cc index bec08f2..8d37d40 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc
@@ -1049,11 +1049,9 @@ #ifdef __BIONIC__ __get_tls()[TLS_SLOT_ART_THREAD_SELF] = this; #else + CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self"); Thread::self_tls_ = this; #endif - // On Bionic, we can set pthread_key_self_ to any non-null value. We use the pthread_key_self_ - // destructor to detect cases where the thread wasn't detached before exiting. - CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, this), "attach self"); DCHECK_EQ(Thread::Current(), this); tls32_.thin_lock_thread_id = thread_list->AllocThreadId(this); @@ -2460,11 +2458,9 @@ #ifdef __BIONIC__ __get_tls()[TLS_SLOT_ART_THREAD_SELF] = self; #else + CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, self), "reattach self"); Thread::self_tls_ = self; #endif - // On Bionic, we can set pthread_key_self_ to any non-null value. We use the pthread_key_self_ - // destructor to detect cases where the thread wasn't detached before exiting. - CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, self), "reattach self"); self->tls32_.thread_exit_check_count = 1; } else { LOG(FATAL) << "Native thread exited without calling DetachCurrentThread: " << *self;
diff --git a/runtime/thread_list.cc b/runtime/thread_list.cc index 29be22c..60e3d72 100644 --- a/runtime/thread_list.cc +++ b/runtime/thread_list.cc
@@ -1613,11 +1613,9 @@ #ifdef __BIONIC__ __get_tls()[TLS_SLOT_ART_THREAD_SELF] = nullptr; #else + CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, nullptr), "detach self"); Thread::self_tls_ = nullptr; #endif - // On Bionic, we use the pthread_key_self_ destructor to detect cases where the thread wasn't - // detached before exiting. - CHECK_PTHREAD_CALL(pthread_setspecific, (Thread::pthread_key_self_, nullptr), "detach self"); // Signal that a thread just detached. MutexLock mu(nullptr, *Locks::thread_list_lock_);