make core compile with new js stuff and Task replacement class
[org.ibex.core.git] / src / org / ibex / core / Scheduler.java
index ee44c43..8fdb506 100644 (file)
@@ -17,10 +17,10 @@ public class Scheduler {
     // 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;
@@ -51,7 +51,7 @@ public class Scheduler {
 
     /**
      *  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.
      */
@@ -64,7 +64,7 @@ public class Scheduler {
     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) {
@@ -79,14 +79,14 @@ public class Scheduler {
                         }
                     }
                     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();