scalation.coroutine

Coroutine

trait Coroutine extends PQItem with Ordered[Coroutine]

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.

Linear Supertypes
Ordered[Coroutine], Comparable[Coroutine], PQItem, Identifiable, Error, AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Coroutine
  2. Ordered
  3. Comparable
  4. PQItem
  5. Identifiable
  6. Error
  7. AnyRef
  8. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def run(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    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.

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. def <(that: Coroutine): Boolean

    Definition Classes
    Ordered
  5. def <=(that: Coroutine): Boolean

    Definition Classes
    Ordered
  6. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. def >(that: Coroutine): Boolean

    Definition Classes
    Ordered
  9. def >=(that: Coroutine): Boolean

    Definition Classes
    Ordered
  10. var actTime: Double

    The activation time for the item in the time-ordered priority queue

    The activation time for the item in the time-ordered priority queue

    Definition Classes
    PQItem
  11. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def compare(other: Coroutine): Int

    Compare the activation times of the two coroutines.

    Compare the activation times of the two coroutines.

    Definition Classes
    Coroutine → Ordered
  14. def compare(other: PQItem): Int

    Compare two items (PQItems) based on their actTime.

    Compare two items (PQItems) based on their actTime.

    other

    the other item to compare with this item

    Definition Classes
    PQItem
  15. def compareTo(that: Coroutine): Int

    Definition Classes
    Ordered → Comparable
  16. final def end(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    Terminates the coroutine, regardless of state.

  17. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  19. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  20. def flaw(method: String, message: String): Unit

    Show the flaw by printing the error message.

    Show the flaw by printing the error message.

    method

    the method where the error occurred

    message

    the error message

    Definition Classes
    Error
  21. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  22. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  23. def id: Int

    Get the id (unique identifier).

    Get the id (unique identifier).

    Definition Classes
    Identifiable
  24. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  25. def me: String

    Return the full identity.

    Return the full identity.

    Definition Classes
    Identifiable
  26. def name: String

    Get the name.

    Get the name.

    Definition Classes
    Identifiable
  27. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  28. final def notify(): Unit

    Definition Classes
    AnyRef
  29. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  30. final def pause(delay: Int, scheduler: Scheduler = Coroutine.defaultScheduler): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    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.

    delay

    time delay before the coroutine is resumed

    scheduler

    the coroutine scheduler

  31. def postRun(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    When the coroutine is finished executing its run function, this function is executed.

  32. def preRun(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    When the coroutine is started, this function is executed before the run function.

  33. final def restart(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    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.

  34. final def resume(): Unit

    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.

  35. def setName(label: String): Unit

    Set the name.

    Set the name.

    label

    the name to assign

    Definition Classes
    Identifiable
  36. def simType: String

    Get the type of the simulation object.

    Get the type of the simulation object.

    Definition Classes
    Identifiable
  37. final def start(): Unit

    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.

  38. def state(): State

    Current state of the coroutine.

  39. final def suspend(): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    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.

  40. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  41. def toString(): String

    Convert the item (PQItem) to a string.

    Convert the item (PQItem) to a string.

    Definition Classes
    PQItem → AnyRef → Any
  42. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def yieldToCoroutine(coroutine: Coroutine): Unit @scala.util.continuations.cpsParam[Unit,Unit]

    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.

    coroutine

    the coroutine to yield to

Inherited from Ordered[Coroutine]

Inherited from Comparable[Coroutine]

Inherited from PQItem

Inherited from Identifiable

Inherited from Error

Inherited from AnyRef

Inherited from Any

Ungrouped