*/
public class ThreadMessage extends Thread implements Message {
- public static boolean fakeBackground = false;
-
private volatile static int threadcount = 0;
/** the JavaScript function that we are executing */
/** attempts to put this thread into the background to perform a blocking operation; returns false if unable to do so */
public static boolean suspendThread() {
- if (fakeBackground) return true;
// put ourselves in the background
Thread thread = Thread.currentThread();
if (!(thread instanceof ThreadMessage)) {
/** re-enqueues this thread */
public static void resumeThread() {
- if (fakeBackground) return;
ThreadMessage mythread = (ThreadMessage)Thread.currentThread();
Message.Q.add(mythread);
mythread.setPriority(Thread.NORM_PRIORITY);