diff --git a/src/share/classes/java/lang/Thread.java b/src/share/classes/java/lang/Thread.java index 3e258e6cdf0715c9d9659088844a5996f089c746..d35e082b84468ab308dea20254944cd15e0ce5f5 100644 --- a/src/share/classes/java/lang/Thread.java +++ b/src/share/classes/java/lang/Thread.java @@ -690,7 +690,7 @@ class Thread implements Runnable { /* Notify the group that this thread is about to be started * so that it can be added to the group's list of threads * and the group's unstarted count can be decremented. */ - group.threadStarting(this); + group.add(this); boolean started = false; try { diff --git a/src/share/classes/java/lang/ThreadGroup.java b/src/share/classes/java/lang/ThreadGroup.java index 945dfe2017541592c9cf9806d72c769dfb71d75c..e27f17550a02e76a4e41aba78097d5879073c181 100644 --- a/src/share/classes/java/lang/ThreadGroup.java +++ b/src/share/classes/java/lang/ThreadGroup.java @@ -867,21 +867,6 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { } } - /** - * Notifies the group that the thread {@code t} is about to be - * started and adds the thread to this thread group. - * - * The thread is now a fully fledged member of the group, even though - * it hasn't been started yet. It will prevent the group from being - * destroyed so the unstarted Threads count is decremented. - */ - void threadStarting(Thread t) { - synchronized (this) { - add(t); - nUnstartedThreads--; - } - } - /** * Adds the specified thread to this thread group. * @@ -910,6 +895,12 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { // This is done last so it doesn't matter in case the // thread is killed nthreads++; + + // The thread is now a fully fledged member of the group, even + // though it may, or may not, have been started yet. It will prevent + // the group from being destroyed so the unstarted Threads count is + // decremented. + nUnstartedThreads--; } }