X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FThreadMessage.java;h=faf75772d582b686478d84851461e9d41d19d86c;hb=49dffbfee615d9105c6e6bb1fda67e5647addd22;hp=f4f95a923575689b0b5b46a1c19ac6482afb6c0e;hpb=e58686eae8a823ed64ed0ec92c2274c41d90ec93;p=org.ibex.core.git diff --git a/src/org/xwt/ThreadMessage.java b/src/org/xwt/ThreadMessage.java index f4f95a9..faf7577 100644 --- a/src/org/xwt/ThreadMessage.java +++ b/src/org/xwt/ThreadMessage.java @@ -20,7 +20,7 @@ public class ThreadMessage extends Thread implements Message { 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(); @@ -38,7 +38,7 @@ public class ThreadMessage extends Thread implements Message { private static Object[] emptyobj = new Object[] { }; /** creates a new thread to execute function f */ - 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(); @@ -56,7 +56,7 @@ public class ThreadMessage extends Thread implements Message { // 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.log(ThreadMessage.class, "attempt to perform background-only operation in a foreground thread at " + Context.getCurrentSourceNameAndLine()); return false; } ThreadMessage mythread = (ThreadMessage)thread; @@ -79,14 +79,14 @@ public class ThreadMessage extends Thread implements Message { while (true) { try { go.block(); - f.call(new JS.Array()); + f.call(new Array()); } catch (JS.Exn e) { if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e); } 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);