add Thread.name field

This commit is contained in:
Zsombor 2008-07-13 18:21:04 -06:00 committed by Joel Dice
parent e1d712ef71
commit 0e539615e7
2 changed files with 12 additions and 5 deletions

View File

@ -20,9 +20,11 @@ public class Thread implements Runnable {
private boolean interrupted;
private Object sleepLock;
private ClassLoader classLoader;
private String name;
public Thread(Runnable task) {
this.task = task;
public Thread(Runnable task, String name) {
this(task);
this.name = name;
Thread current = currentThread();
@ -39,8 +41,8 @@ public class Thread implements Runnable {
classLoader = current.classLoader;
}
public Thread(Runnable task, String name) {
this(task);
public Thread(Runnable task) {
this(task, "Thread["+task+"]");
}
public synchronized void start() {
@ -118,4 +120,9 @@ public class Thread implements Runnable {
public static native int activeCount();
public static native int enumerate(Thread[] array);
public String getName() {
return name;
}
}

View File

@ -1847,7 +1847,7 @@ Thread::init()
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
} else {
this->javaThread = makeThread
(this, reinterpret_cast<int64_t>(this), 0, 0, 0, 0, m->loader);
(this, reinterpret_cast<int64_t>(this), 0, 0, 0, 0, m->loader, 0);
}
}