Permalink
Browse files

Minor nits.

	modified:   src/kilim/Scheduler.java
	modified:   src/kilim/Task.java
  • Loading branch information...
1 parent 03dadd5 commit 74d728f792981785429df8ac5ad8ed6e4dc89129 @sriram-srinivasan sriram-srinivasan committed Apr 1, 2010
Showing with 6 additions and 4 deletions.
  1. +3 −2 src/kilim/Scheduler.java
  2. +3 −2 src/kilim/Task.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;
}
+ */
}
View
@@ -59,7 +59,7 @@
* 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<Integer> sleepmb = new Mailbox<Integer>();
+ final Mailbox<Integer> sleepmb = new Mailbox<Integer>(1); // TODO: will need a better mechanism for monitoring later on.
timer.schedule(new TimerTask() {
public void run() {
sleepmb.putnb(0);

0 comments on commit 74d728f

Please sign in to comment.