When an an instance of a class that mixes in Couroutine
, starting the
coroutine causes the run
function to be called.
When an an instance of a class that mixes in Couroutine
, starting the
coroutine causes the run
function to be called. The general contract
among all coroutines is that only the run
function one coroutine can
be executing at any given time.
The activation time for the item in the time-ordered priority queue
The activation time for the item in the time-ordered priority queue
Compare the activation times of the two coroutines.
Compare the activation times of the two coroutines.
Compare two items (PQItems) based on their actTime.
Compare two items (PQItems) based on their actTime.
the other item to compare with this item
Terminates the coroutine, regardless of state.
Show the flaw by printing the error message.
Show the flaw by printing the error message.
the method where the error occurred
the error message
Get the id (unique identifier).
Get the id (unique identifier).
Return the full identity.
Return the full identity.
Get the name.
Get the name.
If the coroutine is running, suspends the coroutine for a certain amount of time.
If the coroutine is running, suspends the coroutine for a certain amount
of time. If the coroutine is suspended, then begin execution again after
a certain amount of time. Time units depend on the coroutine scheduler.
If no coroutine scheduler is provided then the default,
Coroutine.defaultScheduler
, is used.
time delay before the coroutine is resumed
the coroutine scheduler
When the coroutine is finished executing its run
function, this
function is executed.
When the coroutine is started, this function is executed before the run
function.
Causes this coroutine to restart execution.
Causes this coroutine to restart execution. If another coroutine is
currently being executed, then that coroutine is suspended before this
one is executed. If this coroutine has not already been started, then
this has the same effect as the run
function. It is important to note
that the state from any previous execution of this coroutine is not saved.
If the coroutine is suspended, it is resumed and continues its execution.
If the coroutine is suspended, it is resumed and continues its execution.
If the coroutine is in some other state, the behavior of this function is to be treated as undefined.
Set the name.
Get the type of the simulation object.
Get the type of the simulation object.
Causes this coroutine to begin execution.
Causes this coroutine to begin execution. If another coroutine is
currently being executed, then that coroutine is suspended before this
one is executed. If this coroutine has already been started, then this
has the same effect as the restart
function.
Current state of the coroutine.
If the coroutine is running, it is suspended and makes no further progress unless and until it is resumed.
If the coroutine is running, it is suspended and makes no further progress unless and until it is resumed.
If the coroutine is in some other state, the behavior of this function is to be treated as undefined.
Convert the item (PQItem) to a string.
Convert the item (PQItem) to a string.
If the coroutine is running, suspend execution indefinitely and yield to another coroutine.
If the coroutine is running, suspend execution indefinitely and yield to another coroutine. If the other coroutine has never been started, then it is started.
If the coroutine is in some other state, the behavior of this function is to be treated as undefined.
the coroutine to yield to
The
Coroutine
trait provides a more restricted form of interleaved execution than actors or threads. In particular, only one coroutine can be in the running state at any one time. This reduces concurrency, but also simplifies synchronization problems. For certain domains such as process- oriented simulation, this restricted concurrency is all that is needed. This coroutine package schedules couroutines to run in time order.The current implementation is based on delimited continuations. To use continuations, provide the option
-P:continuations:enable
to the Scala compiler or REPL to activate the compiler plugin.