A asymmetric coroutine library for C.
Switch branches/tags
Nothing to show
Clone or download
cloudwu Merge pull request #4 from Andrew-He/master
Made tiny change on include section to adapt compile on OSX
Latest commit a626303 May 6, 2016
Failed to load latest commit information.
LICENSE Create LICENSE Feb 19, 2014
Makefile Hello world Jul 23, 2012
README.md blog link Jul 23, 2012
coroutine.c change header for compilation on mac May 5, 2016
coroutine.h Hello world Jul 23, 2012
main.c Hello world Jul 23, 2012


It's an asymmetric coroutine library (like lua).

You can use coroutine_open to open a schedule first, and then create coroutine in that schedule.

You should call coroutine_resume in the thread that you call coroutine_open, and you can't call it in a coroutine in the same schedule.

Coroutines in the same schedule share the stack , so you can create many coroutines without worry about memory.

But switching context will copy the stack the coroutine used.

Read source for detail.

Chinese blog : http://blog.codingnow.com/2012/07/c_coroutine.html