Coroutines in C

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • Mongoose

    Embedded Web Server (by cesanta)

  • I've found myself at this webpage multiple times while trying to minimize the complexity of APIs in my C projects.

    My conclusion for now is that C coroutines are something to be left to the implementer. For example: Mongoose (https://github.com/cesanta/mongoose) uses event callbacks to deal with asynchronousness. It is much more pleasant to wrap a library like this in whatever thread/task primitives your system has rather than try to integrate the mythical cross-platform c couroutine.

  • libmobile

    An implementation of the Mobile Adapter GB protocol, to connect to custom game servers.

  • The "switch" method isn't too uncommon, but usually people have an init function and "state" pointer that's passed into the coroutine function. I've used this method a lot in embedded projects, where one coroutine was handling motor acceleration/deceleration while the other would simply tell it what direction to go, but I've also used it for networked libraries[1].

    You don't really need to introduce macro hell for it to be manageable, though I've never found reading switch/case flow to be very enjoyable.

    [1]: https://github.com/REONTeam/libmobile/blob/master/relay.c#L3...

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • Bunki

    A simple C coroutine library.

  • I honestly like stackful coroutines if you don’t mind allocating memory for a stack.

    https://github.com/Keith-Cancel/Bunki

  • rfcs

    RFCs for changes to Rust

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts