diff --git a/src/kilim/Scheduler.java b/src/kilim/Scheduler.java index f5c2c23..b8f1713 100755 --- a/src/kilim/Scheduler.java +++ b/src/kilim/Scheduler.java @@ -73,7 +73,7 @@ public void schedule(Task t) { wt = getWaitingThread(); if (wt != null) { synchronized(wt) { - wt.notify(); + wt.notify(); //TODO: Move to workerthread, because wait has moved. } } } @@ -144,7 +144,7 @@ public void dump() { // w.dumpStack(); // } } - +/* public static boolean isRunnable(Task task) { Scheduler s = defaultScheduler; synchronized (s) { @@ -157,4 +157,5 @@ public static boolean isRunnable(Task task) { } return false; } + */ } diff --git a/src/kilim/Task.java b/src/kilim/Task.java index e8ad620..ce1b253 100755 --- a/src/kilim/Task.java +++ b/src/kilim/Task.java @@ -59,7 +59,7 @@ public abstract class Task implements EventSubscriber { * to be pinned to a thread. * @see kilim.ReentrantLock */ - WorkerThread preferredResumeThread; + volatile WorkerThread preferredResumeThread; /** * @see Task#preferredResumeThread @@ -149,6 +149,7 @@ public int getStackDepth() { } public void onEvent(EventPublisher ep, Event e) { + // TODO: FIX HORRIBLE HACK. // This is sneaky. We _know_ that the only time a task will get registered // is mailbox.put or get(), and that it'll be the pausereason as well. if (ep == pauseReason) { @@ -332,7 +333,7 @@ private static Method getWovenMethod(Method m) { */ public static void sleep(final long millis) throws Pausable { // create a temp mailbox, and wait on it. - final Mailbox sleepmb = new Mailbox(); + final Mailbox sleepmb = new Mailbox(1); // TODO: will need a better mechanism for monitoring later on. timer.schedule(new TimerTask() { public void run() { sleepmb.putnb(0);