## Coroutinecc 协程库[![Build Status](https://travis-ci.org/cunfate/coroutinecc.svg?branch=master)](https://travis-ci.org/cunfate/coroutinecc)
- 基于*nix的`<ucontext.h>`实现
- 参考云风的[coroutine](https://github.com/cloudwu/coroutine)实现
- 支持linux、unix、Mac OS X
- 协程库实现相关文章可以参考[从ucontext到coroutine](https://www.jianshu.com/p/a96b31da3ab0)
## 未来改进:
1. 提供对等协程实现
2. hook进一些systemcall,将所有fd设为非阻塞,并在epoll中切换协程,实现用户侧阻塞IO,实现侧非阻塞效率。
### 构建 && 测试
```s
$ make
$ bin/test
```
控制台应当打印:
```s
main start
coroutine 0 : 0
coroutine 1 : 200
coroutine 0 : 1
coroutine 1 : 201
coroutine 0 : 2
coroutine 1 : 202
coroutine 0 : 3
coroutine 1 : 203
coroutine 0 : 4
coroutine 1 : 204
main end
```
简单的性能测试可以:
```s
$ bin/test-perform
```
在Ubuntu 16.04LTS, i7-5500U 3GB(VMWARE虚拟机)测试结果为:
```s
switch times test start!
switch times test end!
It can switch 879039.736991 times
```
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
基于ucontext实现的C++协程库.zip (11个子文件)
SJT-code
lib
libcoroutine.a 132KB
.travis.yml 290B
Makefile 428B
src
coroutine.h 2KB
coroutine.cc 5KB
LICENSE 1KB
bin
test-perform 60KB
test 59KB
test
test.cc 817B
testperform.cc 1KB
README.md 1KB
共 11 条
- 1
资源评论
JJJ69
- 粉丝: 6223
- 资源: 5780
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功