|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object orc.runtime.Kilim
public final class Kilim
Utility methods for Kilim.
Nested Class Summary | |
---|---|
static class |
Kilim.PausableCallable<V>
Pausable computation which returns a value. |
static class |
Kilim.Promise<V>
Wrap a callable in a lazy, concurrency-safe promise. |
Field Summary | |
---|---|
static java.lang.Object |
signal
Kilim mailboxes can't accomodate null values, so this acts as a basic signal or unit value when necessary. |
Constructor Summary | |
---|---|
Kilim()
|
Method Summary | ||
---|---|---|
static void |
exit()
|
|
static void |
runPausable(Token caller,
Kilim.PausableCallable<? extends java.lang.Object> thunk)
Utility method to run a pausable computation which generates a value for a token. |
|
static
|
runThreaded(java.util.concurrent.Callable<V> thunk)
Spawn a thread to compute a value. |
|
static void |
runThreaded(java.lang.Runnable thunk)
Spawn a thread asynchronously. |
|
static
|
runThreaded(Token caller,
java.util.concurrent.Callable<V> thunk)
Spawn a thread to compute a value for a token. |
|
static void |
startEngine(int kilimThreads,
int siteThreads)
Initialize Kilim state for a new job. |
|
static void |
stopEngine()
Shutdown Kilim threads created for the current job. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Object signal
Constructor Detail |
---|
public Kilim()
Method Detail |
---|
public static void startEngine(int kilimThreads, int siteThreads)
public static void stopEngine()
public static <V> V runThreaded(java.util.concurrent.Callable<V> thunk) throws kilim.Pausable, java.lang.Exception
FIXME: I ran into about 5 different weird Kilim bugs trying to write this function; the current structure is not ideal but it was the only one which worked.
kilim.Pausable
java.lang.Exception
public static <V> void runThreaded(Token caller, java.util.concurrent.Callable<V> thunk)
runThreaded(Callable)
public static void runThreaded(java.lang.Runnable thunk) throws kilim.Pausable
runThreaded(Callable)
.
The point of this over new Thread() { ... }.start()
is
that this uses a thread pool.
thunk
-
kilim.Pausable
public static void runPausable(Token caller, Kilim.PausableCallable<? extends java.lang.Object> thunk)
caller
- token to return the value tothunk
- computation returning a valuepublic static void exit() throws kilim.Pausable
kilim.Pausable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |