C-Coroutines VS coro-chat

Compare C-Coroutines vs coro-chat and see what are their differences.

coro-chat

Playing with the C++17 Coroutines TS to implement a simple chat server (by heavenlake)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
C-Coroutines coro-chat
2 1
72 0
- -
0.0 0.0
about 7 years ago over 4 years ago
C C++
GNU Lesser General Public License v3.0 only -
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

C-Coroutines

Posts with mentions or reviews of C-Coroutines. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-02-22.
  • Does anyone here actually UNDERSTAND coroutines?
    1 project | /r/cpp_questions | 3 Jun 2021
    A coroutine is an execution context + all necessary data for restoring the execution context. This includes a place for saving/restoring the stack and the registers. I always loved the simplicity and beauty of the coroutine_yield32: assembly implementation of this library. It's literally just swapping out stack and registers with another context in userspace. Async-await patterns are an abstraction around this to decide when to switch and when not to switch. Note that at no point a thread is started or stopped, or communicated with other threads/cores. Yielding is literally a series of unconditional moves.
  • David Mazieres' tutorial and take on C++20 coroutines
    5 projects | news.ycombinator.com | 22 Feb 2021
    Or take advantage of the ABI of the runtime, and use assembly. [1] Yeah, not portable. But using setjmp()/longjmp() has issues as well (way too easy to mess it up because it doesn't do what you think it's doing).

    [1] https://github.com/spc476/C-Coroutines

coro-chat

Posts with mentions or reviews of coro-chat. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2021-02-22.
  • David Mazieres' tutorial and take on C++20 coroutines
    5 projects | news.ycombinator.com | 22 Feb 2021
    Stackless means when you resume a coroutine you're still using the same OS thread stack. Coroutine contexts/activation records are conceptually heap allocated (although in some cases that can be optimized away).

    You can use coroutines for what you say, but there are no execution contexts (like a thread pool or an event loop) in C++20 standard library in which to execute coroutines, so to async I/O you need to use a library or DIY. This will come later as part of the Executors proposal.

    You can currently use C++ native coroutines withe ASIO library, but this is probably subject to quite a bit of API churn in the future:

    https://www.boost.org/doc/libs/1_75_0/doc/html/boost_asio/ov...

    You can also wrap things like ASIO yourself. I did this in 2018 when I was learning about C++ coroutines to create a simple telnet based chatroom:

    https://github.com/heavenlake/coro-chat/blob/master/chat.cpp

    Note that this code is likely garbage by todays standards.

What are some alternatives?

When comparing C-Coroutines and coro-chat you can also consider the following projects:

cppcoro - A library of C++ coroutine abstractions for the coroutines TS

asyncly - C++ concurrent programming library