home *** CD-ROM | disk | FTP | other *** search
- package java.lang;
-
- public class Thread implements Runnable {
- private char[] name;
- private int priority;
- private Thread threadQ;
- private int PrivateInfo;
- private int eetop;
- private boolean single_step;
- private boolean daemon = false;
- private boolean stillborn = false;
- private Runnable target;
- private static Thread activeThreadQ;
- private ThreadGroup group;
- private static int threadInitNumber;
- private int initial_stack_memory;
- public static final int MIN_PRIORITY = 1;
- public static final int NORM_PRIORITY = 5;
- public static final int MAX_PRIORITY = 10;
-
- private static synchronized int nextThreadNum() {
- return threadInitNumber++;
- }
-
- public static native Thread currentThread();
-
- public static native void yield();
-
- public static native void sleep(long var0) throws InterruptedException;
-
- public static void sleep(long var0, int var2) throws InterruptedException {
- if (var0 < 0L) {
- throw new IllegalArgumentException("timeout value is negative");
- } else if (var2 >= 0 && var2 <= 999999) {
- if (var2 >= 500000 || var2 != 0 && var0 == 0L) {
- ++var0;
- }
-
- sleep(var0);
- } else {
- throw new IllegalArgumentException("nanosecond timeout value out of range");
- }
- }
-
- private void init(ThreadGroup var1, Runnable var2, String var3) {
- Thread var4 = currentThread();
- if (var1 == null) {
- SecurityManager var5 = System.getSecurityManager();
- if (var5 != null) {
- var1 = var5.getThreadGroup();
- }
-
- if (var1 == null) {
- var1 = var4.getThreadGroup();
- }
- }
-
- var1.checkAccess();
- this.group = var1;
- this.daemon = var4.isDaemon();
- this.priority = var4.getPriority();
- this.name = var3.toCharArray();
- this.target = var2;
- this.setPriority(this.priority);
- var1.add(this);
- }
-
- public Thread() {
- this.init((ThreadGroup)null, (Runnable)null, "Thread-" + nextThreadNum());
- }
-
- public Thread(Runnable var1) {
- this.init((ThreadGroup)null, var1, "Thread-" + nextThreadNum());
- }
-
- public Thread(ThreadGroup var1, Runnable var2) {
- this.init(var1, var2, "Thread-" + nextThreadNum());
- }
-
- public Thread(String var1) {
- this.init((ThreadGroup)null, (Runnable)null, var1);
- }
-
- public Thread(ThreadGroup var1, String var2) {
- this.init(var1, (Runnable)null, var2);
- }
-
- public Thread(Runnable var1, String var2) {
- this.init((ThreadGroup)null, var1, var2);
- }
-
- public Thread(ThreadGroup var1, Runnable var2, String var3) {
- this.init(var1, var2, var3);
- }
-
- public synchronized native void start();
-
- public void run() {
- if (this.target != null) {
- this.target.run();
- }
-
- }
-
- private void exit() {
- if (this.group != null) {
- this.group.remove(this);
- this.group = null;
- }
-
- this.target = null;
- }
-
- public final void stop() {
- this.stop(new ThreadDeath());
- }
-
- public final synchronized void stop(Throwable var1) {
- this.checkAccess();
- this.resume();
- this.stop0(var1);
- }
-
- public void interrupt() {
- this.checkAccess();
- this.interrupt0();
- }
-
- public static boolean interrupted() {
- return currentThread().isInterrupted(true);
- }
-
- public boolean isInterrupted() {
- return this.isInterrupted(false);
- }
-
- private native boolean isInterrupted(boolean var1);
-
- public void destroy() {
- throw new NoSuchMethodError();
- }
-
- public final native boolean isAlive();
-
- public final void suspend() {
- this.checkAccess();
- this.suspend0();
- }
-
- public final void resume() {
- this.checkAccess();
- this.resume0();
- }
-
- public final void setPriority(int var1) {
- this.checkAccess();
- if (var1 <= 10 && var1 >= 1) {
- if (var1 > this.group.getMaxPriority()) {
- var1 = this.group.getMaxPriority();
- }
-
- this.setPriority0(this.priority = var1);
- } else {
- throw new IllegalArgumentException();
- }
- }
-
- public final int getPriority() {
- return this.priority;
- }
-
- public final void setName(String var1) {
- this.checkAccess();
- this.name = var1.toCharArray();
- }
-
- public final String getName() {
- return String.valueOf(this.name);
- }
-
- public final ThreadGroup getThreadGroup() {
- return this.group;
- }
-
- public static int activeCount() {
- return currentThread().getThreadGroup().activeCount();
- }
-
- public static int enumerate(Thread[] var0) {
- return currentThread().getThreadGroup().enumerate(var0);
- }
-
- public native int countStackFrames();
-
- public final synchronized void join(long var1) throws InterruptedException {
- long var3 = System.currentTimeMillis();
- long var5 = 0L;
- if (var1 < 0L) {
- throw new IllegalArgumentException("timeout value is negative");
- } else if (var1 == 0L) {
- while(this.isAlive()) {
- this.wait(0L);
- }
-
- } else {
- while(this.isAlive()) {
- long var7 = var1 - var5;
- if (var7 <= 0L) {
- break;
- }
-
- this.wait(var7);
- var5 = System.currentTimeMillis() - var3;
- }
-
- }
- }
-
- public final synchronized void join(long var1, int var3) throws InterruptedException {
- if (var1 < 0L) {
- throw new IllegalArgumentException("timeout value is negative");
- } else if (var3 >= 0 && var3 <= 999999) {
- if (var3 >= 500000 || var3 != 0 && var1 == 0L) {
- ++var1;
- }
-
- this.join(var1);
- } else {
- throw new IllegalArgumentException("nanosecond timeout value out of range");
- }
- }
-
- public final void join() throws InterruptedException {
- this.join(0L);
- }
-
- public static void dumpStack() {
- (new Exception("Stack trace")).printStackTrace();
- }
-
- public final void setDaemon(boolean var1) {
- this.checkAccess();
- if (this.isAlive()) {
- throw new IllegalThreadStateException();
- } else {
- this.daemon = var1;
- }
- }
-
- public final boolean isDaemon() {
- return this.daemon;
- }
-
- public void checkAccess() {
- SecurityManager var1 = System.getSecurityManager();
- if (var1 != null) {
- var1.checkAccess(this);
- }
-
- }
-
- public String toString() {
- return this.getThreadGroup() != null ? "Thread[" + this.getName() + "," + this.getPriority() + "," + this.getThreadGroup().getName() + "]" : "Thread[" + this.getName() + "," + this.getPriority() + "," + "" + "]";
- }
-
- private native void setPriority0(int var1);
-
- private native void stop0(Object var1);
-
- private native void suspend0();
-
- private native void resume0();
-
- private native void interrupt0();
- }
-