Skip to content

pointertobios/asco

Repository files navigation

ASCO

MIT License

C++20 coroutine based async framework (C++23 needed).

Getting Started

#include <print>
#include <asco/future.h>

using asco::future, asco::future_spawn;

future<int> non_spawn_foo() {
    co_return 42;
}

future_spawn<void> spawn_bar() {
    std::println("Calling spawn coroutine");
    return;
}

future<int> async_main() {
    std::println("Hello, World!", co_await non_spawn_foo());
    co_await spawn_bar();
    co_return 0;
}

Documentations

Import into your project

Use as submodule

  1. Clone one of this repository's version tag.
  2. Use with cmake:
  • Static link:
add_subdirectory(<path-to-this-repo>)
target_link_libraries(<your-target> PRIVATE asco::core asco::main)
  • Dynamic link:
add_subdirectory(<path-to-this-repo>)
target_link_libraries(<your-target> PRIVATE asco::shared::core asco::shared::main)

Use with cmake FetchContent_Declare()

  • How to import
include(FetchContent)

FetchContent_Declare(
    asco
    GIT_REPOSITORY https://github.com/pointertobios/asco.git
    GIT_TAG <version-tag>
)
FetchContent_MakeAvailable(asco)
  • Static link:
target_link_libraries(<your-target> PRIVATE asco::core asco::main)
  • Dynamic link:
target_link_libraries(<your-target> PRIVATE asco::shared::core asco::shared::main)

Features

  • Basic async runtime
    • Platform support
      • Linux full support
      • Windows full support
      • MacOS full support
    • Runtime core
      • Worker thread pool
      • Task scheduling
      • Task stealing
      • Timers
        • High resolution timer
        • Timer wheel
      • Cancellation with context
      • IO
        • io_uring (Linux)
        • Epoll (Linux)
        • IOCP (Windows)
        • Kqueue (MacOS) (Wait please)
  • Basic tools for concurrent programming
    • Sync Primitives
      • Spin
      • Semaphore
      • Channel
      • Mutex
      • Read-Write Lock
      • Condition variable
      • Barrier
      • Latch
    • Sleep and Interval
    • Join set
    • Select
  • Async IO
    • Async file IO
    • Async TCP/UDP stream
    • Buffered IO
  • No lock data structures and parallel algorithms
    • continuous_queue
    • ring_queue
  • More to come...

Compilers

  • Clang: Fully supported.
  • GCC: Not complete.
  • MSVC: Not supported.

Development & Contributing

See CONTRIBUTING.md for details.

License

This project is licensed under the MIT License.

Copyright (C) 2025 pointer-to-bios pointer-to-bios@outlook.com

For full legal terms, see the LICENSE file.