-// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the GNU General Public License version 2 ("the License").
+// You may not use this file except in compliance with the License.
+
package org.ibex.core;
import java.io.IOException;
// Public API Exposed to org.ibex /////////////////////////////////////////////////
private static Scheduler singleton;
- public static void add(Task t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); }
+ public static void add(Callable t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); }
public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); }
- private static Task current = null;
+ private static Callable current = null;
private static volatile boolean rendering = false;
private static volatile boolean again = false;
/**
* SCHEDULER INVARIANT: all scheduler implementations MUST invoke
- * Surface.renderAll() after performing a Task if no tasks remain
+ * Surface.renderAll() after performing a Callable if no tasks remain
* in the queue. A scheduler may choose to invoke
* Surface.renderAll() more often than that if it so chooses.
*/
protected static Queue runnable = new Queue(50);
public void defaultRun() {
while(true) {
- current = (Task)runnable.remove(true);
+ current = (Callable)runnable.remove(true);
try {
// FIXME hideous
synchronized(this) {
}
}
Log.debug(Scheduler.class, "performing " + current);
- current.perform();
+ current.run(null);
}
renderAll();
} catch (JSExn e) {
Log.info(Scheduler.class, "a JavaScript thread spawned with ibex.thread() threw an exception:");
Log.info(Scheduler.class,e);
} catch (Exception e) {
- Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:");
+ Log.info(Scheduler.class, "a Callable threw an exception which was caught by the scheduler:");
Log.info(Scheduler.class, e);
} catch (Throwable t) {
t.printStackTrace();