https://github.com/cloudwu/coroutine
A asymmetric coroutine library for C.
https://github.com/cloudwu/coroutine
Last synced: 7 days ago
JSON representation
A asymmetric coroutine library for C.
- Host: GitHub
- URL: https://github.com/cloudwu/coroutine
- Owner: cloudwu
- License: mit
- Created: 2012-07-23T13:17:21.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2022-12-16T09:23:01.000Z (about 2 years ago)
- Last Synced: 2025-02-08T00:07:45.198Z (14 days ago)
- Language: C
- Size: 8.79 KB
- Stars: 2,474
- Watchers: 136
- Forks: 689
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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