public final class Fiber
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Fiber.MethodRef |
static interface |
Fiber.Worker |
| Modifier and Type | Field and Description |
|---|---|
State |
curState
The current frame's state (local vars and elements of the operand stack
that will be needed when the Fiber is resumed.
|
static int |
NOT_PAUSING__HAS_STATE |
static int |
NOT_PAUSING__NO_STATE |
static int |
PAUSING__HAS_STATE |
static int |
PAUSING__NO_STATE |
int |
pc
The "program counter", kept equal to stateStack[iStack].pc and is used to
jump to the appropriate place in the code while rewinding the code, and
also to inform the weaved code inside an exception handler which pausable
method (if at all) was being invoked when that exception was thrown.
|
Task |
task |
| Modifier and Type | Method and Description |
|---|---|
Fiber |
begin() |
Fiber |
down() |
boolean |
end()
end() is the last up().
|
java.lang.Object |
getCallee()
Called by the weaved code while rewinding the stack.
|
State |
getState() |
boolean |
isDone() |
static void |
pause() |
static void |
pause(Fiber f) |
void |
reset() |
void |
setCallee(java.lang.Object callee) |
void |
setState(State state)
Called by the generated code before pausing and unwinding its stack
frame.
|
Task |
task() |
java.lang.String |
toString() |
int |
up() |
int |
upEx()
In the normal (non-exception) scheme of things, the iStack is incremented
by down() on the way down and decremented by a corresponding up() when returning
or pausing.
|
void |
wrongPC() |
static void |
yield()
yield cooperatively to the next task waiting to use the thread
|
static void |
yield(Fiber f)
yield cooperatively to the next task waiting to use the thread
|
public State curState
public int pc
public Task task
public static final int NOT_PAUSING__NO_STATE
public static final int NOT_PAUSING__HAS_STATE
public static final int PAUSING__NO_STATE
public static final int PAUSING__HAS_STATE
public Fiber(Task t)
public Task task()
public boolean isDone()
public void reset()
public static void yield()
throws Pausable
Pausablepublic static void yield(Fiber f)
public static void pause(Fiber f)
public int up()
public final Fiber begin()
public final boolean end()
public Fiber down()
public int upEx()
at kilim.Fiber.upEx(Fiber.java:250) at kilim.test.ex.ExCatch.normalCatch(ExCatch.java) at kilim.test.ex.ExCatch.test(ExCatch.java) at kilim.test.ex.ExCatch.execute(ExCatch.java) at kilim.Task.runExecute(Task.java) at kilim.WorkerThread.run(WorkerThread.java:11)We have to figure out the stack depth (iStack) of the method that caught the exception and called upEx ("normalCatch" here). The call stack below runExecute may be owned by the scheduler, which may permit more than one task to build up on the stack. For this reason, we let the scheduler tell us the depth of upEx below the task's execute().
public java.lang.Object getCallee()
public void setCallee(java.lang.Object callee)
public void setState(State state)
state - public State getState()
public java.lang.String toString()
toString in class java.lang.Objectpublic void wrongPC()