way better
[org.ibex.core.git] / src / org / ibex / Scheduler.java
index 43be3d9..46b076a 100644 (file)
@@ -1,6 +1,8 @@
 // Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
 package org.ibex;
 
+import java.io.IOException;
+
 import org.ibex.js.*;
 import org.ibex.util.*;
 
@@ -10,7 +12,7 @@ public class Scheduler {
     // Public API Exposed to org.ibex /////////////////////////////////////////////////
 
     private static Scheduler singleton;
-    public static interface Task { public abstract void perform() throws Exception; }
+    public static interface Task { public abstract void perform() throws IOException, JSExn; }
     public static void add(Task t) { Scheduler.runnable.append(t); }
     public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); }
 
@@ -58,6 +60,7 @@ public class Scheduler {
     protected static Queue runnable = new Queue(50);
     public void defaultRun() {
         while(true) {
+            System.out.println("enter");
             current = (Task)runnable.remove(true);
             try {
                 // FIXME hideous
@@ -82,8 +85,11 @@ public class Scheduler {
             } catch (Exception e) {
                 Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:");
                 Log.info(Scheduler.class, e);
+            } catch (Throwable t) {
+                t.printStackTrace();
             }
             // if an Error is thrown it will cause the engine to quit
+            System.out.println("leave");
         }
     }
 }