projects
/
org.ibex.core.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
2003/11/03 00:08:26
[org.ibex.core.git]
/
src
/
org
/
xwt
/
Scheduler.java
diff --git
a/src/org/xwt/Scheduler.java
b/src/org/xwt/Scheduler.java
index
95fd6bf
..
2cb7892
100644
(file)
--- a/
src/org/xwt/Scheduler.java
+++ b/
src/org/xwt/Scheduler.java
@@
-5,24
+5,22
@@
import java.util.*;
import org.xwt.js.*;
import org.xwt.util.*;
import org.xwt.js.*;
import org.xwt.util.*;
-// FEATURE: reimplement Watcher
/** Implements cooperative multitasking */
public class Scheduler {
/** Implements cooperative multitasking */
public class Scheduler {
- private static Scheduler singleton = new Scheduler();
- public static void run() { singleton.do_run(); }
+ public static final Scheduler singleton = Platform.getScheduler();
protected Scheduler() { }
protected Scheduler() { }
- public static abstract class Task implements Callback { public abstract Object call(Object o); }
-
- private static Queue runnable = new Queue(50);
+ public static abstract class Task { public abstract void perform(); }
+ protected static Queue runnable = new Queue(50);
public static void add(Task t) { singleton.runnable.append(t); }
public static void add(Task t) { singleton.runnable.append(t); }
- public void do_run() {
+ public void run() {
while(true) {
Task t = (Task)runnable.remove(true);
try {
while(true) {
Task t = (Task)runnable.remove(true);
try {
- t.call(null);
+ t.perform();
+ // FIXME: be smarter about this
for(int i=0; i<Surface.allSurfaces.size(); i++)
((Surface)Surface.allSurfaces.elementAt(i)).render();
} catch (Exception e) {
for(int i=0; i<Surface.allSurfaces.size(); i++)
((Surface)Surface.allSurfaces.elementAt(i)).render();
} catch (Exception e) {