open-coroutine
What is open-coroutine ?
The open-coroutine
is a simple, efficient and generic stackful-coroutine library.
Status
Still under development, please do not
use this library in the production
environment !
Features
0.2.0
-
use correct
epoll_event
struct -
use
rayon
for parallel computing -
support
#[open_coroutine::main]
macro -
hook almost all
read
syscall- recv
- readv
- pread
- preadv
- recvfrom
- recvmsg
-
hook almost all
write
syscall- send
- write
- writev
- sendto
- sendmsg
- pwrite
- pwritev
-
hook other syscall
- sleep
- usleep
- nanosleep
- connect
- listen
- accept
- shutdown
- poll
- select
0.1.0
- basic suspend/resume supported
- use jemalloc as memory pool
- higher level coroutine abstraction supported
- preemptive scheduling supported
- work stealing supported
- sleep system call hooks supported
How to use this library ?
step1
add dependency to your Cargo.toml
[]
# check https://crates.io/crates/open-coroutine
= "x.y.z"
step2
enable hooks
//step2 enable hooks
step3
enjoy the performance improvement brought by open-coroutine
!
examples
run hello example
cargo run --example hello
code below
use co;
use c_void;
use Duration;
Note: not supported for windows
run preemptive example
cargo run --example preemptive
code below
use co;
use c_void;
use Duration;