Download
31 lines 630 BMarkdownModified 2025-09-01 raw

Tomo Coroutine Library

This is a coroutine library for Tomo built on top of a modified version of libaco.

Example Usage

# modules.ini
[coroutines]
version=v1.0
git=https://github.com/bruce-hill/tomo-coroutines
use coroutines

func main()
    co := Coroutine(func()
        say("I'm in the coroutine!")
        yield()
        say("I'm back in the coroutine!")
    )
    >> co
    say("I'm in the main func")
    >> co.resume()
    say("I'm back in the main func")
    >> co.resume()
    say("I'm back in the main func again")
    >> co.resume()
12345678910111213141516171819202122232425262728293031
# Tomo Coroutine Library

This is a coroutine library for [Tomo](https://tomo.bruce-hill.com) built on
top of a modified version of [libaco](https://libaco.org).

## Example Usage

```ini
# modules.ini
[coroutines]
version=v1.0
git=https://github.com/bruce-hill/tomo-coroutines
```

```tomo
use coroutines

func main()
    co := Coroutine(func()
        say("I'm in the coroutine!")
        yield()
        say("I'm back in the coroutine!")
    )
    >> co
    say("I'm in the main func")
    >> co.resume()
    say("I'm back in the main func")
    >> co.resume()
    say("I'm back in the main func again")
    >> co.resume()
```