Skip to content

Tanker coroutine library

License

Notifications You must be signed in to change notification settings

TankerHQ/tconcurrent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

3ba976f · Aug 27, 2024
Apr 13, 2022
Aug 9, 2024
Aug 27, 2024
Apr 11, 2024
Oct 8, 2020
Apr 21, 2021
Dec 5, 2018
Apr 11, 2024
Apr 21, 2021
Apr 11, 2024
Dec 5, 2018
Apr 13, 2022
Aug 9, 2024
Apr 11, 2024
Apr 11, 2024
Apr 11, 2024

Repository files navigation

Tanker logo

License

Tanker coroutine library

Table of Contents

Overview

tconcurrent is a coroutine library that allows writing asynchronous code that is both C++14 and coroutines-TS-compatible.

The coroutines are stackful when compiled in C++14 mode and stackless when using the coroutines-TS mode.

Example

tconcurrent exposes an async_resumable function that will run a coroutine asynchronously. A coroutine function must return a tc::cotask and can then use the TC_AWAIT and TC_RETURN macros.

int main()
{
  // Run an asynchronous task, like `std::async`
  tc::future<std::string> f1 = tc::async([]() -> std::string {
    return "42";
  });

  // Run a resumable asynchronous task
  tc::future<int> f2 = tc::async_resumable([]() -> tc::cotask<int> {
    int const val = TC_AWAIT(receive_value());
    TC_AWAIT(send_value(val * 2));
    TC_RETURN(42);
  });

  f1.get();
  f2.get();
}

Setup

We are actively working to allow external developers to build and test this SDK from its source.

Doxygen

To generate and open documentation:

$ cd doc && doxygen && xdg-open build/html/index.html

Documentation

To better understand how tconcurrent works, a big picture explanation is here:

Contributing

We welcome feedback. Feel free to open any issue on the Github bug tracker.

License and Terms

The tconcurrent library is licensed under the Apache License, version 2.0.