Merge branch 'master' of https://source.jalview.org/git/jalviewjs.git
[jalviewjs.git] / site / j2s / java / lang / Thread.js
index af5c29e..93b5ae9 100644 (file)
-Clazz.declarePackage ("java.lang");\r
-Clazz.load (["java.lang.Enum"], "java.lang.Thread", ["java.lang.Exception", "$.IllegalArgumentException", "$.IllegalThreadStateException", "$.NoSuchMethodError", "$.NullPointerException", "$.ThreadDeath", "java.util.HashMap", "java.lang.ThreadGroup", "swingjs.JSToolkit"], function () {\r
-c$ = Clazz.decorateAsClass (function () {\r
-this.name = null;\r
-this.priority = 5;\r
-this.daemon = false;\r
-this.target = null;\r
-this.group = null;\r
-this.tid = 0;\r
-this.threadStatus = 0;\r
-this.parkBlocker = null;\r
-this.stopBeforeStart = false;\r
-this.throwableFromStop = null;\r
-this.me = null;\r
-this.uncaughtExceptionHandler = null;\r
-this.$interrupted = false;\r
-this.stopped = false;\r
-Clazz.instantialize (this, arguments);\r
-}, java.lang, "Thread", null, Runnable);\r
-c$.nextThreadNum = Clazz.defineMethod (c$, "nextThreadNum", \r
- function () {\r
-return java.lang.Thread.threadInitNumber++;\r
-});\r
-c$.nextThreadID = Clazz.defineMethod (c$, "nextThreadID", \r
- function () {\r
-return ++java.lang.Thread.threadSeqNumber;\r
-});\r
-c$.currentThread = Clazz.defineMethod (c$, "currentThread", \r
-function () {\r
-if (java.lang.Thread.thisThread == null) {\r
-java.lang.Thread.thisThread =  new java.lang.Thread ("master");\r
-java.lang.Thread.thisThread.setPriority (5);\r
-}return java.lang.Thread.thisThread;\r
-});\r
-c$.yield = Clazz.defineMethod (c$, "yield", \r
-function () {\r
-});\r
-c$.sleep = Clazz.defineMethod (c$, "sleep", \r
-function (millis) {\r
-}, "~N");\r
-c$.sleep = Clazz.defineMethod (c$, "sleep", \r
-function (millis, nanos) {\r
-if (millis < 0) {\r
-throw  new IllegalArgumentException ("timeout value is negative");\r
-}if (nanos < 0 || nanos > 999999) {\r
-throw  new IllegalArgumentException ("nanosecond timeout value out of range");\r
-}if (nanos >= 500000 || (nanos != 0 && millis == 0)) {\r
-millis++;\r
-}java.lang.Thread.sleep (millis);\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "init", \r
- function (g, target, name, stackSize) {\r
-this.init (g, target, name, stackSize, null);\r
-}, "java.lang.ThreadGroup,Runnable,~S,~N");\r
-Clazz.defineMethod (c$, "init", \r
- function (g, target, name, stackSize, acc) {\r
-var parent = (java.lang.Thread.thisThread == null ? null : java.lang.Thread.thisThread);\r
-if (g == null) {\r
-if (g == null && parent != null) {\r
-g = parent.getThreadGroup ();\r
-}}if (g == null) {\r
-g = this.newThreadGroup (null, name);\r
-parent = this;\r
-}g.checkAccess ();\r
-g.addUnstarted ();\r
-this.group = g;\r
-this.priority = parent.getPriority ();\r
-this.name = name;\r
-this.target = target;\r
-this.setPriority (this.priority);\r
-this.tid = java.lang.Thread.nextThreadID ();\r
-this.me = this;\r
-}, "java.lang.ThreadGroup,Runnable,~S,~N,~O");\r
-Clazz.defineMethod (c$, "newThreadGroup", \r
-function (group, name) {\r
-return  new java.lang.ThreadGroup (group, name);\r
-}, "java.lang.ThreadGroup,~S");\r
-Clazz.makeConstructor (c$, \r
-function () {\r
-this.init (null, null, "Thread-" + java.lang.Thread.nextThreadNum (), 0);\r
-});\r
-Clazz.makeConstructor (c$, \r
-function (target) {\r
-this.init (null, target, "Thread-" + java.lang.Thread.nextThreadNum (), 0);\r
-}, "Runnable");\r
-Clazz.makeConstructor (c$, \r
-function (group, target) {\r
-this.init (group, target, "Thread-" + java.lang.Thread.nextThreadNum (), 0);\r
-}, "java.lang.ThreadGroup,Runnable");\r
-Clazz.makeConstructor (c$, \r
-function (name) {\r
-this.init (null, null, name, 0);\r
-}, "~S");\r
-Clazz.makeConstructor (c$, \r
-function (group, name) {\r
-this.init (group, null, name, 0);\r
-}, "java.lang.ThreadGroup,~S");\r
-Clazz.makeConstructor (c$, \r
-function (target, name) {\r
-this.init (null, target, name, 0);\r
-}, "Runnable,~S");\r
-Clazz.makeConstructor (c$, \r
-function (group, target, name) {\r
-this.init (group, target, name, 0);\r
-}, "java.lang.ThreadGroup,Runnable,~S");\r
-Clazz.makeConstructor (c$, \r
-function (group, target, name, stackSize) {\r
-this.init (group, target, name, stackSize);\r
-}, "java.lang.ThreadGroup,Runnable,~S,~N");\r
-Clazz.defineMethod (c$, "start", \r
-function () {\r
-if (this.threadStatus != 0 || this !== this.me) throw  new IllegalThreadStateException ();\r
-this.group.add (this);\r
-this.start0 ();\r
-if (this.stopBeforeStart) {\r
-this.stop0 (this.throwableFromStop);\r
-}});\r
-Clazz.defineMethod (c$, "start0", \r
- function () {\r
-});\r
-Clazz.defineMethod (c$, "run", \r
-function () {\r
-if (this.target != null) {\r
-this.target.run ();\r
-}});\r
-Clazz.defineMethod (c$, "stop", \r
-function () {\r
-if ((this.threadStatus != 0) && !this.isAlive ()) {\r
-return;\r
-}this.stop1 ( new ThreadDeath ());\r
-});\r
-Clazz.defineMethod (c$, "stop", \r
-function (obj) {\r
-this.stop1 (obj);\r
-}, "Throwable");\r
-Clazz.defineMethod (c$, "stop1", \r
- function (th) {\r
-if (this.threadStatus != 0) {\r
-this.resume ();\r
-this.stop0 (th);\r
-} else {\r
-if (th == null) {\r
-throw  new NullPointerException ();\r
-}this.stopBeforeStart = true;\r
-this.throwableFromStop = th;\r
-}}, "Throwable");\r
-Clazz.defineMethod (c$, "interrupt", \r
-function () {\r
-this.interrupt0 ();\r
-});\r
-c$.interrupted = Clazz.defineMethod (c$, "interrupted", \r
-function () {\r
-return java.lang.Thread.currentThread ().isInterruptedB (true);\r
-});\r
-Clazz.defineMethod (c$, "isInterrupted", \r
-function () {\r
-return this.isInterruptedB (false);\r
-});\r
-Clazz.defineMethod (c$, "isInterruptedB", \r
- function (clearInterrupted) {\r
-var wasInt = this.$interrupted;\r
-if (clearInterrupted) this.$interrupted = false;\r
-return wasInt;\r
-}, "~B");\r
-Clazz.defineMethod (c$, "destroy", \r
-function () {\r
-throw  new NoSuchMethodError ();\r
-});\r
-Clazz.defineMethod (c$, "isAlive", \r
-function () {\r
-return true;\r
-});\r
-Clazz.defineMethod (c$, "suspend", \r
-function () {\r
-this.checkAccess ();\r
-this.suspend0 ();\r
-});\r
-Clazz.defineMethod (c$, "resume", \r
-function () {\r
-this.checkAccess ();\r
-this.resume0 ();\r
-});\r
-Clazz.defineMethod (c$, "setPriority", \r
-function (newPriority) {\r
-var g;\r
-this.checkAccess ();\r
-if (newPriority > 10 || newPriority < 1) {\r
-throw  new IllegalArgumentException ();\r
-}if ((g = this.getThreadGroup ()) != null) {\r
-if (newPriority > g.getMaxPriority ()) {\r
-newPriority = g.getMaxPriority ();\r
-}this.setPriority0 (this.priority = newPriority);\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "getPriority", \r
-function () {\r
-return this.priority;\r
-});\r
-Clazz.defineMethod (c$, "setName", \r
-function (name) {\r
-this.checkAccess ();\r
-this.name = name;\r
-}, "~S");\r
-Clazz.defineMethod (c$, "getName", \r
-function () {\r
-return this.name;\r
-});\r
-Clazz.defineMethod (c$, "getThreadGroup", \r
-function () {\r
-return this.group;\r
-});\r
-c$.activeCount = Clazz.defineMethod (c$, "activeCount", \r
-function () {\r
-return java.lang.Thread.currentThread ().getThreadGroup ().activeCount ();\r
-});\r
-c$.enumerate = Clazz.defineMethod (c$, "enumerate", \r
-function (tarray) {\r
-return java.lang.Thread.currentThread ().getThreadGroup ().enumerate (tarray);\r
-}, "~A");\r
-Clazz.defineMethod (c$, "countStackFrames", \r
-function () {\r
-return 0;\r
-});\r
-Clazz.defineMethod (c$, "join", \r
-function (millis) {\r
-var base = System.currentTimeMillis ();\r
-var now = 0;\r
-if (millis < 0) {\r
-throw  new IllegalArgumentException ("timeout value is negative");\r
-}swingjs.JSToolkit.warn ("Cannot wait in Thread");\r
-if (millis == 0) {\r
-while (this.isAlive ()) {\r
-this.wait (0);\r
-}\r
-} else {\r
-while (this.isAlive ()) {\r
-var delay = millis - now;\r
-if (delay <= 0) {\r
-break;\r
-}this.wait (delay);\r
-now = System.currentTimeMillis () - base;\r
-}\r
-}}, "~N");\r
-Clazz.defineMethod (c$, "join", \r
-function (millis, nanos) {\r
-if (millis < 0) {\r
-throw  new IllegalArgumentException ("timeout value is negative");\r
-}if (nanos < 0 || nanos > 999999) {\r
-throw  new IllegalArgumentException ("nanosecond timeout value out of range");\r
-}if (nanos >= 500000 || (nanos != 0 && millis == 0)) {\r
-millis++;\r
-}this.join (millis);\r
-}, "~N,~N");\r
-Clazz.defineMethod (c$, "join", \r
-function () {\r
-this.join (0);\r
-});\r
-c$.dumpStack = Clazz.defineMethod (c$, "dumpStack", \r
-function () {\r
- new Exception ("Stack trace").printStackTrace ();\r
-});\r
-Clazz.defineMethod (c$, "setDaemon", \r
-function (on) {\r
-this.checkAccess ();\r
-if (this.isAlive ()) {\r
-throw  new IllegalThreadStateException ();\r
-}this.daemon = on;\r
-}, "~B");\r
-Clazz.defineMethod (c$, "isDaemon", \r
-function () {\r
-return this.daemon;\r
-});\r
-Clazz.defineMethod (c$, "checkAccess", \r
-function () {\r
-});\r
-Clazz.overrideMethod (c$, "toString", \r
-function () {\r
-var group = this.getThreadGroup ();\r
-if (group != null) {\r
-return "Thread[" + this.getName () + "," + this.getPriority () + "," + group.getName () + "]";\r
-} else {\r
-return "Thread[" + this.getName () + "," + this.getPriority () + "," + "" + "]";\r
-}});\r
-Clazz.defineMethod (c$, "getContextClassLoader", \r
-function () {\r
-return null;\r
-});\r
-Clazz.defineMethod (c$, "setContextClassLoader", \r
-function (cl) {\r
-}, "ClassLoader");\r
-c$.holdsLock = Clazz.defineMethod (c$, "holdsLock", \r
-function (obj) {\r
-return false;\r
-}, "~O");\r
-Clazz.defineMethod (c$, "getStackTrace", \r
-function () {\r
-return ( new Exception ()).getStackTrace ();\r
-});\r
-c$.getAllStackTraces = Clazz.defineMethod (c$, "getAllStackTraces", \r
-function () {\r
-var threads = java.lang.Thread.getThreads ();\r
-var traces = java.lang.Thread.dumpThreads (threads);\r
-var m =  new java.util.HashMap (threads.length);\r
-for (var i = 0; i < threads.length; i++) {\r
-var stackTrace = traces[i];\r
-if (stackTrace != null) {\r
-m.put (threads[i], stackTrace);\r
-}}\r
-return m;\r
-});\r
-c$.dumpThreads = Clazz.defineMethod (c$, "dumpThreads", \r
- function (threads) {\r
-return null;\r
-}, "~A");\r
-c$.getThreads = Clazz.defineMethod (c$, "getThreads", \r
- function () {\r
-return null;\r
-});\r
-Clazz.defineMethod (c$, "getId", \r
-function () {\r
-return this.tid;\r
-});\r
-Clazz.defineMethod (c$, "getState", \r
-function () {\r
-switch (this.threadStatus) {\r
-case 0:\r
-return java.lang.Thread.State.NEW;\r
-case 1:\r
-return java.lang.Thread.State.RUNNABLE;\r
-case 2:\r
-default:\r
-return java.lang.Thread.State.TERMINATED;\r
-case 3:\r
-return java.lang.Thread.State.TIMED_WAITING;\r
-case 4:\r
-return java.lang.Thread.State.WAITING;\r
-}\r
-});\r
-c$.setDefaultUncaughtExceptionHandler = Clazz.defineMethod (c$, "setDefaultUncaughtExceptionHandler", \r
-function (eh) {\r
-java.lang.Thread.defaultUncaughtExceptionHandler = eh;\r
-}, "java.lang.Thread.UncaughtExceptionHandler");\r
-c$.getDefaultUncaughtExceptionHandler = Clazz.defineMethod (c$, "getDefaultUncaughtExceptionHandler", \r
-function () {\r
-return java.lang.Thread.defaultUncaughtExceptionHandler;\r
-});\r
-Clazz.defineMethod (c$, "getUncaughtExceptionHandler", \r
-function () {\r
-return this.uncaughtExceptionHandler != null ? this.uncaughtExceptionHandler : this.group;\r
-});\r
-Clazz.defineMethod (c$, "setUncaughtExceptionHandler", \r
-function (eh) {\r
-this.checkAccess ();\r
-this.uncaughtExceptionHandler = eh;\r
-}, "java.lang.Thread.UncaughtExceptionHandler");\r
-Clazz.defineMethod (c$, "setPriority0", \r
- function (newPriority) {\r
-}, "~N");\r
-Clazz.defineMethod (c$, "stop0", \r
- function (o) {\r
-this.stopped = true;\r
-}, "~O");\r
-Clazz.defineMethod (c$, "suspend0", \r
- function () {\r
-});\r
-Clazz.defineMethod (c$, "resume0", \r
- function () {\r
-});\r
-Clazz.defineMethod (c$, "interrupt0", \r
- function () {\r
-this.$interrupted = true;\r
-});\r
-Clazz.pu$h(self.c$);\r
-c$ = Clazz.declareType (java.lang.Thread, "State", Enum);\r
-Clazz.defineEnumConstant (c$, "NEW", 0, []);\r
-Clazz.defineEnumConstant (c$, "RUNNABLE", 1, []);\r
-Clazz.defineEnumConstant (c$, "BLOCKED", 2, []);\r
-Clazz.defineEnumConstant (c$, "WAITING", 3, []);\r
-Clazz.defineEnumConstant (c$, "TIMED_WAITING", 4, []);\r
-Clazz.defineEnumConstant (c$, "TERMINATED", 5, []);\r
-c$ = Clazz.p0p ();\r
-Clazz.declareInterface (java.lang.Thread, "UncaughtExceptionHandler");\r
-Clazz.defineStatics (c$,\r
-"threadInitNumber", 0,\r
-"threadSeqNumber", 0,\r
-"thisThread", null,\r
-"MIN_PRIORITY", 1,\r
-"NORM_PRIORITY", 5,\r
-"MAX_PRIORITY", 10,\r
-"defaultUncaughtExceptionHandler", null);\r
-});\r
+Clazz.declarePackage ("java.lang");
+Clazz.load (["java.lang.Enum"], "java.lang.Thread", ["java.lang.Exception", "$.IllegalArgumentException", "$.IllegalThreadStateException", "$.NoSuchMethodError", "$.NullPointerException", "$.ThreadDeath", "java.util.HashMap", "java.lang.ThreadGroup", "swingjs.JSToolkit"], function () {
+c$ = Clazz.decorateAsClass (function () {
+this.name = null;
+this.priority = 5;
+this.daemon = false;
+this.target = null;
+this.group = null;
+this.tid = 0;
+this.threadStatus = 0;
+this.parkBlocker = null;
+this.stopBeforeStart = false;
+this.throwableFromStop = null;
+this.me = null;
+this.uncaughtExceptionHandler = null;
+this.$interrupted = false;
+this.stopped = false;
+Clazz.instantialize (this, arguments);
+}, java.lang, "Thread", null, Runnable);
+c$.nextThreadNum = Clazz.defineMethod (c$, "nextThreadNum", 
+ function () {
+return java.lang.Thread.threadInitNumber++;
+});
+c$.nextThreadID = Clazz.defineMethod (c$, "nextThreadID", 
+ function () {
+return ++java.lang.Thread.threadSeqNumber;
+});
+c$.currentThread = Clazz.defineMethod (c$, "currentThread", 
+function () {
+if (java.lang.Thread.thisThread == null) {
+java.lang.Thread.thisThread =  new java.lang.Thread ("master");
+java.lang.Thread.thisThread.setPriority (5);
+}return java.lang.Thread.thisThread;
+});
+c$.yield = Clazz.defineMethod (c$, "yield", 
+function () {
+});
+c$.sleep = Clazz.defineMethod (c$, "sleep", 
+function (millis) {
+}, "~N");
+c$.sleep = Clazz.defineMethod (c$, "sleep", 
+function (millis, nanos) {
+if (millis < 0) {
+throw  new IllegalArgumentException ("timeout value is negative");
+}if (nanos < 0 || nanos > 999999) {
+throw  new IllegalArgumentException ("nanosecond timeout value out of range");
+}if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
+millis++;
+}java.lang.Thread.sleep (millis);
+}, "~N,~N");
+Clazz.defineMethod (c$, "init", 
+ function (g, target, name, stackSize) {
+this.init (g, target, name, stackSize, null);
+}, "java.lang.ThreadGroup,Runnable,~S,~N");
+Clazz.defineMethod (c$, "init", 
+ function (g, target, name, stackSize, acc) {
+var parent = (java.lang.Thread.thisThread == null ? null : java.lang.Thread.thisThread);
+if (g == null) {
+if (g == null && parent != null) {
+g = parent.getThreadGroup ();
+}}if (g == null) {
+g = this.newThreadGroup (null, name);
+parent = this;
+}g.checkAccess ();
+g.addUnstarted ();
+this.group = g;
+this.priority = parent.getPriority ();
+this.name = name;
+this.target = target;
+this.setPriority (this.priority);
+this.tid = java.lang.Thread.nextThreadID ();
+this.me = this;
+}, "java.lang.ThreadGroup,Runnable,~S,~N,~O");
+Clazz.defineMethod (c$, "newThreadGroup", 
+function (group, name) {
+return  new java.lang.ThreadGroup (group, name);
+}, "java.lang.ThreadGroup,~S");
+Clazz.makeConstructor (c$, 
+function () {
+this.init (null, null, "Thread-" + java.lang.Thread.nextThreadNum (), 0);
+});
+Clazz.makeConstructor (c$, 
+function (target) {
+this.init (null, target, "Thread-" + java.lang.Thread.nextThreadNum (), 0);
+}, "Runnable");
+Clazz.makeConstructor (c$, 
+function (group, target) {
+this.init (group, target, "Thread-" + java.lang.Thread.nextThreadNum (), 0);
+}, "java.lang.ThreadGroup,Runnable");
+Clazz.makeConstructor (c$, 
+function (name) {
+this.init (null, null, name, 0);
+}, "~S");
+Clazz.makeConstructor (c$, 
+function (group, name) {
+this.init (group, null, name, 0);
+}, "java.lang.ThreadGroup,~S");
+Clazz.makeConstructor (c$, 
+function (target, name) {
+this.init (null, target, name, 0);
+}, "Runnable,~S");
+Clazz.makeConstructor (c$, 
+function (group, target, name) {
+this.init (group, target, name, 0);
+}, "java.lang.ThreadGroup,Runnable,~S");
+Clazz.makeConstructor (c$, 
+function (group, target, name, stackSize) {
+this.init (group, target, name, stackSize);
+}, "java.lang.ThreadGroup,Runnable,~S,~N");
+Clazz.defineMethod (c$, "start", 
+function () {
+if (this.threadStatus != 0 || this !== this.me) throw  new IllegalThreadStateException ();
+this.group.add (this);
+this.start0 ();
+if (this.stopBeforeStart) {
+this.stop0 (this.throwableFromStop);
+}});
+Clazz.defineMethod (c$, "start0", 
+ function () {
+});
+Clazz.defineMethod (c$, "run", 
+function () {
+if (this.target != null) {
+this.target.run ();
+}});
+Clazz.defineMethod (c$, "stop", 
+function () {
+if ((this.threadStatus != 0) && !this.isAlive ()) {
+return;
+}this.stop1 ( new ThreadDeath ());
+});
+Clazz.defineMethod (c$, "stop", 
+function (obj) {
+this.stop1 (obj);
+}, "Throwable");
+Clazz.defineMethod (c$, "stop1", 
+ function (th) {
+if (this.threadStatus != 0) {
+this.resume ();
+this.stop0 (th);
+} else {
+if (th == null) {
+throw  new NullPointerException ();
+}this.stopBeforeStart = true;
+this.throwableFromStop = th;
+}}, "Throwable");
+Clazz.defineMethod (c$, "interrupt", 
+function () {
+this.interrupt0 ();
+});
+c$.interrupted = Clazz.defineMethod (c$, "interrupted", 
+function () {
+return java.lang.Thread.currentThread ().isInterruptedB (true);
+});
+Clazz.defineMethod (c$, "isInterrupted", 
+function () {
+return this.isInterruptedB (false);
+});
+Clazz.defineMethod (c$, "isInterruptedB", 
+ function (clearInterrupted) {
+var wasInt = this.$interrupted;
+if (clearInterrupted) this.$interrupted = false;
+return wasInt;
+}, "~B");
+Clazz.defineMethod (c$, "destroy", 
+function () {
+throw  new NoSuchMethodError ();
+});
+Clazz.defineMethod (c$, "isAlive", 
+function () {
+return true;
+});
+Clazz.defineMethod (c$, "suspend", 
+function () {
+this.checkAccess ();
+this.suspend0 ();
+});
+Clazz.defineMethod (c$, "resume", 
+function () {
+this.checkAccess ();
+this.resume0 ();
+});
+Clazz.defineMethod (c$, "setPriority", 
+function (newPriority) {
+var g;
+this.checkAccess ();
+if (newPriority > 10 || newPriority < 1) {
+throw  new IllegalArgumentException ();
+}if ((g = this.getThreadGroup ()) != null) {
+if (newPriority > g.getMaxPriority ()) {
+newPriority = g.getMaxPriority ();
+}this.setPriority0 (this.priority = newPriority);
+}}, "~N");
+Clazz.defineMethod (c$, "getPriority", 
+function () {
+return this.priority;
+});
+Clazz.defineMethod (c$, "setName", 
+function (name) {
+this.checkAccess ();
+this.name = name;
+}, "~S");
+Clazz.defineMethod (c$, "getName", 
+function () {
+return this.name;
+});
+Clazz.defineMethod (c$, "getThreadGroup", 
+function () {
+return this.group;
+});
+c$.activeCount = Clazz.defineMethod (c$, "activeCount", 
+function () {
+return java.lang.Thread.currentThread ().getThreadGroup ().activeCount ();
+});
+c$.enumerate = Clazz.defineMethod (c$, "enumerate", 
+function (tarray) {
+return java.lang.Thread.currentThread ().getThreadGroup ().enumerate (tarray);
+}, "~A");
+Clazz.defineMethod (c$, "countStackFrames", 
+function () {
+return 0;
+});
+Clazz.defineMethod (c$, "join", 
+function (millis) {
+var base = System.currentTimeMillis ();
+var now = 0;
+if (millis < 0) {
+throw  new IllegalArgumentException ("timeout value is negative");
+}swingjs.JSToolkit.warn ("Cannot wait in Thread");
+if (millis == 0) {
+while (this.isAlive ()) {
+this.wait (0);
+}
+} else {
+while (this.isAlive ()) {
+var delay = millis - now;
+if (delay <= 0) {
+break;
+}this.wait (delay);
+now = System.currentTimeMillis () - base;
+}
+}}, "~N");
+Clazz.defineMethod (c$, "join", 
+function (millis, nanos) {
+if (millis < 0) {
+throw  new IllegalArgumentException ("timeout value is negative");
+}if (nanos < 0 || nanos > 999999) {
+throw  new IllegalArgumentException ("nanosecond timeout value out of range");
+}if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
+millis++;
+}this.join (millis);
+}, "~N,~N");
+Clazz.defineMethod (c$, "join", 
+function () {
+this.join (0);
+});
+c$.dumpStack = Clazz.defineMethod (c$, "dumpStack", 
+function () {
+ new Exception ("Stack trace").printStackTrace ();
+});
+Clazz.defineMethod (c$, "setDaemon", 
+function (on) {
+this.checkAccess ();
+if (this.isAlive ()) {
+throw  new IllegalThreadStateException ();
+}this.daemon = on;
+}, "~B");
+Clazz.defineMethod (c$, "isDaemon", 
+function () {
+return this.daemon;
+});
+Clazz.defineMethod (c$, "checkAccess", 
+function () {
+});
+Clazz.overrideMethod (c$, "toString", 
+function () {
+var group = this.getThreadGroup ();
+if (group != null) {
+return "Thread[" + this.getName () + "," + this.getPriority () + "," + group.getName () + "]";
+} else {
+return "Thread[" + this.getName () + "," + this.getPriority () + "," + "" + "]";
+}});
+Clazz.defineMethod (c$, "getContextClassLoader", 
+function () {
+return null;
+});
+Clazz.defineMethod (c$, "setContextClassLoader", 
+function (cl) {
+}, "ClassLoader");
+c$.holdsLock = Clazz.defineMethod (c$, "holdsLock", 
+function (obj) {
+return false;
+}, "~O");
+Clazz.defineMethod (c$, "getStackTrace", 
+function () {
+return ( new Exception ()).getStackTrace ();
+});
+c$.getAllStackTraces = Clazz.defineMethod (c$, "getAllStackTraces", 
+function () {
+var threads = java.lang.Thread.getThreads ();
+var traces = java.lang.Thread.dumpThreads (threads);
+var m =  new java.util.HashMap (threads.length);
+for (var i = 0; i < threads.length; i++) {
+var stackTrace = traces[i];
+if (stackTrace != null) {
+m.put (threads[i], stackTrace);
+}}
+return m;
+});
+c$.dumpThreads = Clazz.defineMethod (c$, "dumpThreads", 
+ function (threads) {
+return null;
+}, "~A");
+c$.getThreads = Clazz.defineMethod (c$, "getThreads", 
+ function () {
+return null;
+});
+Clazz.defineMethod (c$, "getId", 
+function () {
+return this.tid;
+});
+Clazz.defineMethod (c$, "getState", 
+function () {
+switch (this.threadStatus) {
+case 0:
+return java.lang.Thread.State.NEW;
+case 1:
+return java.lang.Thread.State.RUNNABLE;
+case 2:
+default:
+return java.lang.Thread.State.TERMINATED;
+case 3:
+return java.lang.Thread.State.TIMED_WAITING;
+case 4:
+return java.lang.Thread.State.WAITING;
+}
+});
+c$.setDefaultUncaughtExceptionHandler = Clazz.defineMethod (c$, "setDefaultUncaughtExceptionHandler", 
+function (eh) {
+java.lang.Thread.defaultUncaughtExceptionHandler = eh;
+}, "java.lang.Thread.UncaughtExceptionHandler");
+c$.getDefaultUncaughtExceptionHandler = Clazz.defineMethod (c$, "getDefaultUncaughtExceptionHandler", 
+function () {
+return java.lang.Thread.defaultUncaughtExceptionHandler;
+});
+Clazz.defineMethod (c$, "getUncaughtExceptionHandler", 
+function () {
+return this.uncaughtExceptionHandler != null ? this.uncaughtExceptionHandler : this.group;
+});
+Clazz.defineMethod (c$, "setUncaughtExceptionHandler", 
+function (eh) {
+this.checkAccess ();
+this.uncaughtExceptionHandler = eh;
+}, "java.lang.Thread.UncaughtExceptionHandler");
+Clazz.defineMethod (c$, "setPriority0", 
+ function (newPriority) {
+}, "~N");
+Clazz.defineMethod (c$, "stop0", 
+ function (o) {
+this.stopped = true;
+}, "~O");
+Clazz.defineMethod (c$, "suspend0", 
+ function () {
+});
+Clazz.defineMethod (c$, "resume0", 
+ function () {
+});
+Clazz.defineMethod (c$, "interrupt0", 
+ function () {
+this.$interrupted = true;
+});
+Clazz.pu$h(self.c$);
+c$ = Clazz.declareType (java.lang.Thread, "State", Enum);
+Clazz.defineEnumConstant (c$, "NEW", 0, []);
+Clazz.defineEnumConstant (c$, "RUNNABLE", 1, []);
+Clazz.defineEnumConstant (c$, "BLOCKED", 2, []);
+Clazz.defineEnumConstant (c$, "WAITING", 3, []);
+Clazz.defineEnumConstant (c$, "TIMED_WAITING", 4, []);
+Clazz.defineEnumConstant (c$, "TERMINATED", 5, []);
+c$ = Clazz.p0p ();
+Clazz.declareInterface (java.lang.Thread, "UncaughtExceptionHandler");
+Clazz.defineStatics (c$,
+"threadInitNumber", 0,
+"threadSeqNumber", 0,
+"thisThread", null,
+"MIN_PRIORITY", 1,
+"NORM_PRIORITY", 5,
+"MAX_PRIORITY", 10,
+"defaultUncaughtExceptionHandler", null);
+});