public static Task current() { return current; }
/** synchronizd so that we can safely call it from an event-delivery thread, in-context */
- public static synchronized void renderAll() {
- for(int i=0; i<Surface.allSurfaces.size(); i++) {
- Surface s = ((Surface)Surface.allSurfaces.elementAt(i));
- do { s.render(); } while(s.abort);
+ 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;
+ }
}
}
}
renderAll();
} catch (JSExn e) {
- Log.log(Scheduler.class, "a JavaScript thread spawned with xwt.thread() threw an exception:");
- Log.log(Scheduler.class, e);
+ Log.info(Scheduler.class, "a JavaScript thread spawned with xwt.thread() threw an exception:");
+ Log.info(Scheduler.class, "JS Exception: " + e.getObject() + "\n" + e.backtrace());
+ Log.info(Scheduler.class,e);
} catch (Exception e) {
- Log.log(Scheduler.class, "a Task threw an exception which was caught by the scheduler:");
- Log.log(Scheduler.class, e);
+ Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:");
+ Log.info(Scheduler.class, e);
}
// if an Error is thrown it will cause the engine to quit
}