1 Star 1 Fork 1

axenhook / coroutine

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

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

co_coroutine.c: pthread like API

  1. coroutine
  2. semaphore for coroutine
  3. barrier for coroutine

co_multi_sched.c: a simple scheduler manager

  1. multi schedulers on the assigned CPUs

test_xxx.c

  1. test program
  2. the API use example

Read source for detail.

origin chinese blog : http://blog.codingnow.com/2012/07/c_coroutine.html

注意:不能将协程栈中的资源进行协程间共享,我踩过这个坑。原因是协程栈在调度出去时其栈内容会被拷贝到此协程的私有空间,然后原栈内容会被新协程的栈数据覆盖。如果要跨协程使用共享资源(比如说信号量),需将共享资源定义在堆空间(比如说malloc申请)或者使用全局变量,或者在非协程所在线程中定义(其栈空间不会被切出去)

powered by axenhook

The MIT License (MIT) Copyright (c) 2020 15714832@qq.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

A asymmetric coroutine library for C. 展开 收起
C
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
C
1
https://gitee.com/axenhook/coroutine.git
git@gitee.com:axenhook/coroutine.git
axenhook
coroutine
coroutine
master

搜索帮助