corda/classpath/java/lang/Thread.java

35 lines
661 B
Java
Raw Normal View History

package java.lang;
2007-07-21 20:44:39 +00:00
import java.util.Map;
import java.util.WeakHashMap;
public class Thread implements Runnable {
private final Runnable task;
2007-07-21 20:44:39 +00:00
private Map<ThreadLocal, Object> locals;
2007-07-07 18:09:16 +00:00
private long peer;
public Thread(Runnable task) {
this.task = task;
}
2007-07-07 18:09:16 +00:00
public synchronized native void start();
public void run() {
if (task != null) {
task.run();
}
}
2007-07-21 20:44:39 +00:00
public Map<ThreadLocal, Object> locals() {
if (locals == null) {
locals = new WeakHashMap();
}
return locals;
}
public static native Thread currentThread();
public static native void sleep(long milliseconds)
throws InterruptedException;
}