X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=blobdiff_plain;f=src%2Forg%2Fibex%2Fcore%2FScheduler.java;h=8fdb506508891924ca408a338bcc47371abb3d63;hp=e4c85fa9a8fab99b028cd58d1c468a162e8afda0;hb=297fdbde87e6db4732448a0950d1141c7265c169;hpb=b881f9415591b5069fe46a6ccc5d833cec816b65 diff --git a/src/org/ibex/core/Scheduler.java b/src/org/ibex/core/Scheduler.java index e4c85fa..8fdb506 100644 --- a/src/org/ibex/core/Scheduler.java +++ b/src/org/ibex/core/Scheduler.java @@ -1,5 +1,8 @@ -// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL] -package org.ibex.util; +// Copyright 2000-2005 the Contributors, as shown in the revision logs. +// Licensed under the GNU General Public License version 2 ("the License"). +// You may not use this file except in compliance with the License. + +package org.ibex.core; import java.io.IOException; @@ -14,10 +17,10 @@ public class Scheduler { // Public API Exposed to org.ibex ///////////////////////////////////////////////// private static Scheduler singleton; - public static void add(Task t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); } + public static void add(Callable t) { Log.debug(Scheduler.class, "scheduling " + t); Scheduler.runnable.append(t); } public static void init() { if (singleton == null) (singleton = Platform.getScheduler()).run(); } - private static Task current = null; + private static Callable current = null; private static volatile boolean rendering = false; private static volatile boolean again = false; @@ -48,7 +51,7 @@ public class Scheduler { /** * SCHEDULER INVARIANT: all scheduler implementations MUST invoke - * Surface.renderAll() after performing a Task if no tasks remain + * Surface.renderAll() after performing a Callable if no tasks remain * in the queue. A scheduler may choose to invoke * Surface.renderAll() more often than that if it so chooses. */ @@ -61,7 +64,7 @@ public class Scheduler { protected static Queue runnable = new Queue(50); public void defaultRun() { while(true) { - current = (Task)runnable.remove(true); + current = (Callable)runnable.remove(true); try { // FIXME hideous synchronized(this) { @@ -76,14 +79,14 @@ public class Scheduler { } } Log.debug(Scheduler.class, "performing " + current); - current.perform(); + current.run(null); } renderAll(); } catch (JSExn e) { Log.info(Scheduler.class, "a JavaScript thread spawned with ibex.thread() threw an exception:"); Log.info(Scheduler.class,e); } catch (Exception e) { - Log.info(Scheduler.class, "a Task threw an exception which was caught by the scheduler:"); + Log.info(Scheduler.class, "a Callable threw an exception which was caught by the scheduler:"); Log.info(Scheduler.class, e); } catch (Throwable t) { t.printStackTrace();