private static Scheduler singleton;
public static interface Task { public abstract void perform() throws Exception; }
+
+ /** adds a task to the back of the queue */
public static void add(Task t) { singleton.runnable.append(t); }
+
+ /** adds a task to the front of the queue (guaranteed to run next) */
+ public static void addAtFront(Task t) { singleton.runnable.prepend(t); }
+
public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); }
// API which must be supported by subclasses /////////////////////////////////////