All Projects → jamboree → act

jamboree / act

Licence: other
ASIO Cooperative Task for await-based coroutine

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to act

Unityfx.async
Asynchronous operations (promises) for Unity3d.
Stars: ✭ 143 (+793.75%)
Mutual labels:  task, coroutines, async-await
Cppcoro
A library of C++ coroutine abstractions for the coroutines TS
Stars: ✭ 2,118 (+13137.5%)
Mutual labels:  coroutines, async-await
Tascalate Async Await
Async / Await asynchronous programming model for Java similar to the functionality available in C# 5. The implementation is based on continuations for Java (see my other projects).
Stars: ✭ 60 (+275%)
Mutual labels:  coroutines, async-await
Asyncex
A helper library for async/await.
Stars: ✭ 2,794 (+17362.5%)
Mutual labels:  task, async-await
Concurrencpp
Modern concurrency for C++. Tasks, executors, timers and C++20 coroutines to rule them all
Stars: ✭ 340 (+2025%)
Mutual labels:  coroutines, async-await
Swiftcoroutine
Swift coroutines for iOS, macOS and Linux.
Stars: ✭ 690 (+4212.5%)
Mutual labels:  coroutines, async-await
Then
🎬 Tame async code with battle-tested promises
Stars: ✭ 908 (+5575%)
Mutual labels:  task, async-await
Restc Cpp
Modern C++ REST Client library
Stars: ✭ 371 (+2218.75%)
Mutual labels:  coroutines, asio
DemOS
Free, simple, extremely lightweight, stackless, cooperative, co-routine system (OS) for microcontrollers
Stars: ✭ 18 (+12.5%)
Mutual labels:  coroutines, cooperative
EnumerableAsyncProcessor
Process Multiple Asynchronous Tasks in Various Ways - One at a time / Batched / Rate limited / Concurrently
Stars: ✭ 84 (+425%)
Mutual labels:  task, async-await
banana
🍌 Modern C++ Telegram Bot API library
Stars: ✭ 30 (+87.5%)
Mutual labels:  coroutines, async-await
snap
Snap Programming Language
Stars: ✭ 20 (+25%)
Mutual labels:  coroutines, async-await
modern async cpp example
Just some example code from a lecture about modern async C++
Stars: ✭ 34 (+112.5%)
Mutual labels:  coroutines, asio
ProtoPromise
Robust and efficient library for management of asynchronous operations in C#/.Net.
Stars: ✭ 20 (+25%)
Mutual labels:  task, coroutines
boost beast websocket echo
A collection of Demo applications to try to help you understand how Asio and Beast work
Stars: ✭ 12 (-25%)
Mutual labels:  coroutines, asio
WanAndroidMVVM
WanAndroid 客户端,采用 Kotlin 语言编写,项目使用 JetPack-MVVM 架构,采用 Retrofit + Coroutines + Coil 等开源框架开发。
Stars: ✭ 21 (+31.25%)
Mutual labels:  coroutines
Test-Assignments
List of test assignments. ⚡
Stars: ✭ 85 (+431.25%)
Mutual labels:  task
swoole-futures
⏳ Futures, Streams & Async/Await for PHP's Swoole asynchronous run-time.
Stars: ✭ 100 (+525%)
Mutual labels:  async-await
UNO
Hooray! Card Game UNO!
Stars: ✭ 208 (+1200%)
Mutual labels:  asio
xtra
🎭 A tiny actor framework
Stars: ✭ 111 (+593.75%)
Mutual labels:  async-await

act

ASIO Cooperative Task

Requirements

  • Compiler that implements N4286
  • Or emulation library like CO2

Dependencies

Example

async echo server

task<void> session(asio::ip::tcp::socket sock)
{
    try
    {
        char buf[1024];
        std::cout << "connected: " << sock.remote_endpoint() << std::endl;
        for ( ; ; )
        {
            act::error_code ec;
            auto len = co_await act::read_some(sock, asio::buffer(buf), ec);
            if (ec == asio::error::eof)
                co_return;
            co_await act::write(sock, asio::buffer(buf, len));
        }
    }
    catch (std::exception& e)
    {
        std::cout << "error: " << sock.remote_endpoint() << ": " << e.what() << std::endl;
    }
}

task<void> server(asio::io_service& io, unsigned short port)
{
    asio::ip::tcp::endpoint endpoint{asio::ip::tcp::v4(), port};
    asio::ip::tcp::acceptor acceptor{io, endpoint};
    asio::ip::tcp::socket sock{io};
    std::cout << "server running at: " << endpoint << std::endl;
    for ( ; ; )
    {
        co_await act::accept(acceptor, sock);
        session(std::move(sock));
    }
}

int main(int argc, char *argv[])
{
    asio::io_service io;
    server(io, std::atoi(argv[1]));
    io.run();

    return EXIT_SUCCESS;
}

License

Copyright (c) 2015-2018 Jamboree

Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].