Package kilim.examples
Class Chain
java.lang.Object
kilim.Task
kilim.examples.Chain
- All Implemented Interfaces:
Runnable,EventSubscriber,Fiber.Worker
Set up a chain of tasks. Each task knows about its mailbox and
that of the next in the chain, but is not given the other tasks
ref.
The main thread pushes an empty StringBuffer into the first task's
mailbox, which writes "hello" into the buffer and passes the
modified StringBuffer on to the next task, and so on. The last
task appends "world", prints it out and exits.
[compile] javac -d ./classes Chain.java
[weave] java kilim.tools.Weave -d ./wclasses kilim.examples.Chain
[run] java -cp ./wclasses:./classes:$CLASSPATH kilim.examples.Chain
-
Nested Class Summary
Nested classes/interfaces inherited from class kilim.Task
Task.Fork, Task.Invoke<TT>, Task.Spawn<TT> -
Field Summary
FieldsModifier and TypeFieldDescription(package private) Mailbox<StringBuffer> (package private) Mailbox<StringBuffer> Fields inherited from class kilim.Task
done, exitResult, fiber, id, pauseReason, running, scheduler, timer -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class kilim.Task
checkKill, dump, equals, errNotWoven, errNotWoven, errorExit, errorExit, execute, exit, exit, fork, getCurrentTask, getExecutionThread, getPauseReason, getScheduler, getStackDepth, getState, getTid, hashCode, id, idledown, informOnExit, invoke, isDone, join, joinb, onEvent, pause, pause, pinToThread, prePin, resume, resumeOnScheduler, run, setPauseReason, setScheduler, setTid, shutdown, sleep, spawn, spawn, start, toString, unpinFromThread, yield, yield
-
Field Details
-
mymb
Mailbox<StringBuffer> mymb -
nextmb
Mailbox<StringBuffer> nextmb
-
-
Constructor Details
-
Chain
-
-
Method Details
-
execute
- Specified by:
executein interfaceFiber.Worker- Overrides:
executein classTask- Throws:
Pausable
-
main
-