+ private static Task currentTask = null;
+ public static Task current() { return currentTask; }
+
+ /** synchronizd so that we can safely call it from an event-delivery thread, in-context */
+ private static volatile boolean rendering = false;
+ private static volatile boolean again = false;
+ public static void renderAll() {
+ if (rendering) { again = true; return; }
+ synchronized(Scheduler.class) {
+ try {
+ rendering = true;
+ do {
+ again = false;
+ for(int i=0; i<Surface.allSurfaces.size(); i++) {
+ Surface s = ((Surface)Surface.allSurfaces.elementAt(i));
+ do { s.render(); } while(s.abort);
+ }
+ } while(again);
+ } finally {
+ rendering = false;
+ }
+ }
+ }
+
+
+