News for hackers. Stuff that matters.
Re:Libaco: A fast and lightweight C asymmetric coroutine lib... by ur-whale on Saturday July 14, 2018 @07:03AM (#17529809)
>You can use coroutines to implement generators

Yes, and threads as well, so back to my original question.

Re:Libaco: A fast and lightweight C asymmetric coroutine lib... by rurban on Sunday July 15, 2018 @12:16AM (#17533762)
The main difference is the low speed of threads (100 slower context switches) and the problems of parallelism: deadlocks, races.

Thats why you use threads for CPU bound tasks, and coros for IO bound tasks. With IO you don't need much CPU, you mostly wait. Coros provide fast switching back and forth until your IO is ready.

Re:Libaco: A fast and lightweight C asymmetric coroutine lib... by amelius on Saturday July 14, 2018 @07:23AM (#17529869)
The use of generators does not imply concurrency, and that's why the use of threads for this purpose is considered overkill (threads require relatively expensive kernel involvement).