• Home
    • View
    • Login
    This page
    • Normal
    • Export PDF
    • Export Word
    • Attachments
    • Page Information

    Loading...
  1. Dashboard
  2. Multi-Language VM
  3. Main
  4. SubProjects
  5. StackContinuations
  6. Coroutines

Page History

Versions Compared

Old Version 3

changes.mady.by.user Lukas Stadler

Saved on Jul 28, 2010

compared with

New Version Current

changes.mady.by.user Lukas Stadler

Saved on Jul 28, 2010

  • Previous Change: Difference between versions 2 and 3
  • View Page History

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Symmetric coroutines are implemented via the Coroutine class. This is used by either subclassing Coroutine and overriding the run method or passing a target Runnable to the Coroutine constructor.

Code Block
borderStylesolid
titleCoroutine.javaborderStylesolid
public class Coroutine {
  public Coroutine();
  public Coroutine(Runnable target);
  public Coroutine(long stacksize);
  public Coroutine(Runnable target, long stacksize);

  public static void yield();
  public static void yieldTo(Coroutine target);

  protected void run();
}

...

  • they are prepared to take an input value and return an output value
  • these input and output values are of generic type
  • the caller/callee relationship of asymmetric coroutines leads to a differentiation between "calling" a coroutine and "returning" from it
  • it implements Iterable so it can be used in for-each loops
Code Block
borderStylesolid
titleAsymCoroutine.javaborderStylesolid
public abstract class AsymCoroutine<InT, OutT> implements Iterable<OutT>
{
  public AsymCoroutine();
  public AsymCoroutine(long stacksize);

  public InT ret(OutT value);
  public InT ret();
  public OutT call(InT input);
  public OutT call();

  protected abstract OutT run(InT value);

  @Override
  public Iterator<OutT> iterator();
}

...

Overview
Content Tools
ThemeBuilder

Terms of Use
• License: GPLv2
• Privacy • Trademarks • Contact Us

Powered by a free Atlassian Confluence Open Source Project License granted to https://www.atlassian.com/software/views/opensource-community-additional-license-offer. Evaluate Confluence today.

  • Kolekti ThemeBuilder Powered by Atlassian Confluence 8.5.21
  • Kolekti ThemeBuilder printed.by.atlassian.confluence
  • Report a bug
  • Atlassian News
Atlassian
Kolekti ThemeBuilder EngineAtlassian Confluence
{"serverDuration": 207, "requestCorrelationId": "a9372b74d5785a46"}