Skip to content

Commit

Permalink
Minor nits.
Browse files Browse the repository at this point in the history
	modified:   src/kilim/Scheduler.java
	modified:   src/kilim/Task.java
  • Loading branch information
sriram-srinivasan committed Apr 1, 2010
1 parent 03dadd5 commit 74d728f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/kilim/Scheduler.java
Expand Up @@ -73,7 +73,7 @@ public void schedule(Task t) {
wt = getWaitingThread(); wt = getWaitingThread();
if (wt != null) { if (wt != null) {
synchronized(wt) { synchronized(wt) {
wt.notify(); wt.notify(); //TODO: Move to workerthread, because wait has moved.
} }
} }
} }
Expand Down Expand Up @@ -144,7 +144,7 @@ public void dump() {
// w.dumpStack(); // w.dumpStack();
// } // }
} }

/*
public static boolean isRunnable(Task task) { public static boolean isRunnable(Task task) {
Scheduler s = defaultScheduler; Scheduler s = defaultScheduler;
synchronized (s) { synchronized (s) {
Expand All @@ -157,4 +157,5 @@ public static boolean isRunnable(Task task) {
} }
return false; return false;
} }
*/
} }
5 changes: 3 additions & 2 deletions src/kilim/Task.java
Expand Up @@ -59,7 +59,7 @@ public abstract class Task implements EventSubscriber {
* to be pinned to a thread. * to be pinned to a thread.
* @see kilim.ReentrantLock * @see kilim.ReentrantLock
*/ */
WorkerThread preferredResumeThread; volatile WorkerThread preferredResumeThread;


/** /**
* @see Task#preferredResumeThread * @see Task#preferredResumeThread
Expand Down Expand Up @@ -149,6 +149,7 @@ public int getStackDepth() {
} }


public void onEvent(EventPublisher ep, Event e) { 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 // 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. // is mailbox.put or get(), and that it'll be the pausereason as well.
if (ep == pauseReason) { if (ep == pauseReason) {
Expand Down Expand Up @@ -332,7 +333,7 @@ private static Method getWovenMethod(Method m) {
*/ */
public static void sleep(final long millis) throws Pausable { public static void sleep(final long millis) throws Pausable {
// create a temp mailbox, and wait on it. // 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() { timer.schedule(new TimerTask() {
public void run() { public void run() {
sleepmb.putnb(0); sleepmb.putnb(0);
Expand Down

0 comments on commit 74d728f

Please sign in to comment.