ART: Call ThreadGroup.add for attached threads
When attaching threads to the runtime, call ThreadGroup.add to
let the thread's group know that the thread is now started. This
fixes incorrect internal accounting.
Test: art/test/testrunner/testrunner.py -b --host -t 169
Test: m test-art-host
Change-Id: I60362b6b53acf06b97779ea9b3b0bc6264f1dc2d
diff --git a/runtime/thread.h b/runtime/thread.h
index 426d27d..295685e 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -511,6 +511,12 @@
static void FinishStartup();
static void Shutdown();
+ // Notify this thread's thread-group that this thread has started.
+ // Note: the given thread-group is used as a fast path and verified in debug build. If the value
+ // is null, the thread's thread-group is loaded from the peer.
+ void NotifyThreadGroup(ScopedObjectAccessAlreadyRunnable& soa, jobject thread_group = nullptr)
+ REQUIRES_SHARED(Locks::mutator_lock_);
+
// JNI methods
JNIEnvExt* GetJniEnv() const {
return tlsPtr_.jni_env;