提交 00b54d23 编写于 作者: L lana

Merge

...@@ -690,7 +690,7 @@ class Thread implements Runnable { ...@@ -690,7 +690,7 @@ class Thread implements Runnable {
/* Notify the group that this thread is about to be started /* Notify the group that this thread is about to be started
* so that it can be added to the group's list of threads * so that it can be added to the group's list of threads
* and the group's unstarted count can be decremented. */ * and the group's unstarted count can be decremented. */
group.threadStarting(this); group.add(this);
boolean started = false; boolean started = false;
try { try {
......
...@@ -867,21 +867,6 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { ...@@ -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. * Adds the specified thread to this thread group.
* *
...@@ -910,6 +895,12 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler { ...@@ -910,6 +895,12 @@ class ThreadGroup implements Thread.UncaughtExceptionHandler {
// This is done last so it doesn't matter in case the // This is done last so it doesn't matter in case the
// thread is killed // thread is killed
nthreads++; 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--;
} }
} }
......
...@@ -36,7 +36,7 @@ package java.util; ...@@ -36,7 +36,7 @@ package java.util;
* @author Jon Bentley * @author Jon Bentley
* @author Josh Bloch * @author Josh Bloch
* *
* @version 2011.01.21 m765.827.12i:5\7pm * @version 2011.02.11 m765.827.12i:5\7pm
* @since 1.7 * @since 1.7
*/ */
final class DualPivotQuicksort { final class DualPivotQuicksort {
...@@ -115,7 +115,7 @@ final class DualPivotQuicksort { ...@@ -115,7 +115,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
...@@ -555,7 +555,7 @@ final class DualPivotQuicksort { ...@@ -555,7 +555,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
...@@ -1027,7 +1027,7 @@ final class DualPivotQuicksort { ...@@ -1027,7 +1027,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
...@@ -1499,7 +1499,7 @@ final class DualPivotQuicksort { ...@@ -1499,7 +1499,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
...@@ -2076,7 +2076,7 @@ final class DualPivotQuicksort { ...@@ -2076,7 +2076,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
...@@ -2603,7 +2603,7 @@ final class DualPivotQuicksort { ...@@ -2603,7 +2603,7 @@ final class DualPivotQuicksort {
* Index run[i] is the start of i-th run * Index run[i] is the start of i-th run
* (ascending or descending sequence). * (ascending or descending sequence).
*/ */
int[] run = new int[MAX_RUN_COUNT]; int[] run = new int[MAX_RUN_COUNT + 1];
int count = 0; run[0] = left; int count = 0; run[0] = left;
// Check if the array is nearly sorted // Check if the array is nearly sorted
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册