-// Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
package org.xwt;
import java.util.*;
private volatile static int threadcount = 0;
/** the JavaScript function that we are executing */
- volatile JS.Function f;
+ volatile JS.Callable f;
/** the ThreadMessage thread blocks on this before executing any JavaScript */
Semaphore go = new Semaphore();
private static Object[] emptyobj = new Object[] { };
/** creates a new thread to execute function <tt>f</tt> */
- public static synchronized void newthread(JS.Function f) {
+ public static synchronized void newthread(JS.Callable f) {
ThreadMessage ret = (ThreadMessage)spare.remove(false);
if (ret == null) {
if (threadcount < Platform.maxThreads()) ret = new ThreadMessage();
// put ourselves in the background
Thread thread = Thread.currentThread();
if (!(thread instanceof ThreadMessage)) {
- if (Log.on) Log.log(ThreadMessage.class, "attempt to perform background-only operation in a foreground thread at " + JS.getCurrentFunctionSourceName());
+ if (Log.on) Log.logJS(ThreadMessage.class, "attempt to perform background-only operation in a foreground thread");
return false;
}
ThreadMessage mythread = (ThreadMessage)thread;
done.release();
synchronized(waiting) {
if (waiting.size() > 0) {
- f = (JS.Function)waiting.remove(false);
+ f = (JS.Callable)waiting.remove(false);
MessageQueue.add(this);
} else if (spare.size() < 10) {
spare.append(this);