mirror of
https://github.com/corda/corda.git
synced 2025-01-07 13:38:47 +00:00
add Thread.name field
This commit is contained in:
parent
e1d712ef71
commit
0e539615e7
@ -20,9 +20,11 @@ public class Thread implements Runnable {
|
|||||||
private boolean interrupted;
|
private boolean interrupted;
|
||||||
private Object sleepLock;
|
private Object sleepLock;
|
||||||
private ClassLoader classLoader;
|
private ClassLoader classLoader;
|
||||||
|
private String name;
|
||||||
|
|
||||||
public Thread(Runnable task) {
|
public Thread(Runnable task, String name) {
|
||||||
this.task = task;
|
this(task);
|
||||||
|
this.name = name;
|
||||||
|
|
||||||
Thread current = currentThread();
|
Thread current = currentThread();
|
||||||
|
|
||||||
@ -39,8 +41,8 @@ public class Thread implements Runnable {
|
|||||||
classLoader = current.classLoader;
|
classLoader = current.classLoader;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Thread(Runnable task, String name) {
|
public Thread(Runnable task) {
|
||||||
this(task);
|
this(task, "Thread["+task+"]");
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void start() {
|
public synchronized void start() {
|
||||||
@ -118,4 +120,9 @@ public class Thread implements Runnable {
|
|||||||
public static native int activeCount();
|
public static native int activeCount();
|
||||||
|
|
||||||
public static native int enumerate(Thread[] array);
|
public static native int enumerate(Thread[] array);
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1847,7 +1847,7 @@ Thread::init()
|
|||||||
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
|
threadPeer(this, javaThread) = reinterpret_cast<jlong>(this);
|
||||||
} else {
|
} else {
|
||||||
this->javaThread = makeThread
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user