Thanks to visit codestin.com
Credit goes to github.com

Skip to content

cunfate/coroutinecc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coroutinecc 协程库Build Status

未来改进:

  1. 提供对等协程实现
  2. hook进一些systemcall,将所有fd设为非阻塞,并在epoll中切换协程,实现用户侧阻塞IO,实现侧非阻塞效率。

构建 && 测试

$ make
$ bin/test

控制台应当打印:

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

简单的性能测试可以:

$ bin/test-perform

在Ubuntu 16.04LTS, i7-5500U 3GB(VMWARE虚拟机)测试结果为:

switch times test start!
switch times test end!
It can switch 879039.736991 times

About

基于ucontext实现的C++协程库

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published