Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.32 KB

README.md

File metadata and controls

32 lines (26 loc) · 1.32 KB

codecov CMake on Ubuntu with G++-13

lzc-coro - LaZyCoders COROutine library

This small library have the objective of understand coroutine facility. It is too a playground to test some ideas about how coroutines could work.

The basics

This library only implements the task: a coroutine that can do co_await.

All tasks can be awaitable and are created stopped. That means a coroutine do not start executing code until the call to operator() of the task is called.

sequenceDiagram
    box Grey Main Thread
        participant main
        participant some_task
        participant other_task
    end
    box Grey  Other Thread
        participant async_function
    end
    main->>some_task: operator()
    some_task->>other_task: co_await
    other_task->>async_function: co_await
    Note over other_task,async_function: The coroutine wait until completion<br/>and continues in the original thread
    async_function-->>other_task:resume()
    other_task-->>some_task:resume()
    some_task-->>main:future.get()
Loading