cloudwu/coroutine

A asymmetric coroutine library for C.

C

2,519

8 commits

updated Dec 16, 2022

See the code

README

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

cloudwu/coroutine

A asymmetric coroutine library for C.

C

2,519

8 commits

updated Dec 16, 2022

See the code

README

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

Significant stargazers

sky

243 followers · starred Jan 2022

Yuan Wang

140 followers · starred Sep 2020

m11y

38 followers · starred May 2021

Chao Wang

22 followers · starred Apr 2014