diff --git a/classpath/java/lang/Thread.java b/classpath/java/lang/Thread.java index 2f7826d32c..cae4e92234 100644 --- a/classpath/java/lang/Thread.java +++ b/classpath/java/lang/Thread.java @@ -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; + } + } diff --git a/src/machine.cpp b/src/machine.cpp index 8703d103c4..1e6556e3f5 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -1847,7 +1847,7 @@ Thread::init() threadPeer(this, javaThread) = reinterpret_cast(this); } else { this->javaThread = makeThread - (this, reinterpret_cast(this), 0, 0, 0, 0, m->loader); + (this, reinterpret_cast(this), 0, 0, 0, 0, m->loader, 0); } }