logoalt Hacker News

syncurrentlast Friday at 9:24 PM1 replyview on HN

A way to implement coroutines in C is via protothreads. I admit that they are a bit hacky - but you can get quite far with them. I used them to implement an Esterel/Blech like environment: https://github.com/frameworklabs/proto_activities


Replies

dhon_last Friday at 11:19 PM

Protothreads are amazing, but really expose you to a lot of subtle bugs. I would not recommend them for any new projects if something like async rust or an RTOS are options.

show 1 reply