Package com.offbynull.coroutines.user
package com.offbynull.coroutines.user
User-level classes for coroutines. The entry-point of your coroutine should be a class that implements
Coroutine
. To run your coroutine, use CoroutineRunner
.
A simple example of a coroutine:
import com.offbynull.coroutines.user.Continuation; import com.offbynull.coroutines.user.Coroutine; public class SimpleTest implements Coroutine { public void run(Continuation c) { System.out.println("started"); for (int i = 0; i < 10; i++) { echo(c, i); } } private void echo(Continuation c, int x) { System.out.println(x); c.suspend(); } }
-
ClassDescriptionThis class is used to store and restore the execution state.Interface to identify a coroutine.Exception that indicates that a problem occurred during the execution of a coroutine.Reads in (deserializes) the state of a
CoroutineRunner
object.Coroutine deserializer.Default implementation ofCoroutineReader.CoroutineDeserializer
(uses Java's built-in serialization mechanism).Used to execute aCoroutine
.Writes out (serializes) the current state of aCoroutineRunner
object.Coroutine serializer.Default implementation ofCoroutineWriter.CoroutineSerializer
(uses Java's built-in serialization mechanism).Do not use -- for internal use only.Do not use -- for internal use only.CoroutineRunner
's state translated for serialization.Data bundle.MethodState
's andLockState
's state translated for serialization.Frame intercept point.Frame modifier.Frame update point.Collection ofSerializedState.Frame
s that are for different versions of the same method and continuation point combination.