You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33-10Lines changed: 33 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,17 +15,18 @@ English | [中文](README_ZH.md)
15
15
## 🚀 Features
16
16
17
17
-[x] Preemptive(`not supported in windows`): even if the coroutine enters a dead loop, it can still be seized, see [example](https://github.com/loongs-zhang/open-coroutine/blob/master/open-coroutine/examples/preemptive.rs);
18
-
-[x] Hook: you are free to use most of the slow system calls in coroutine;
18
+
-[x] Hook: you are free to use most of the slow syscall in coroutine, see supported syscall on [unix](https://github.com/acl-dev/open-coroutine/blob/master/hook/src/syscall/unix.rs)/[windows](https://github.com/acl-dev/open-coroutine/blob/master/hook/src/syscall/windows.rs);
19
19
-[x] Scalable: the size of the coroutine stack supports unlimited expansion without the cost of copying stack, and immediately shrinks to the original size after use, see [example](https://github.com/loongs-zhang/open-coroutine/blob/master/open-coroutine/examples/scalable_stack.rs);
20
20
-[x] io_uring(`only in linux`): supports and is compatible with io_uring in terms of local file IO and network IO. If it's not supported on your system, it will fall back to non-blocking IO;
21
-
-[x] Priority: support custom task and coroutine priority;
22
-
-[x] Work Stealing: internally using a lock free work steal queue;
23
-
-[x] Compatibility: the implementation of open-coroutine is no async, but it is compatible with async, which means you can use this crate in tokio/async-std/smol/...;
21
+
-[x] Priority: support custom task priority, note that coroutine priority is not open to users;
22
+
-[x] Work Steal: internally using a lock free work steal queue;
23
+
-[x] Compatibility: the implementation of open-coroutine is no async, but it is compatible with async, which means you can use this crate in `tokio/async-std/smol/...`;
24
24
-[x] Platforms: running on Linux, macOS and Windows;
25
25
26
26
## 🕊 Roadmap
27
27
28
-
-[ ] support `#[open_coroutine::all_join]` and `#[open_coroutine::any_join]` macro to wait coroutines;
28
+
-[ ] cancel coroutine/task;
29
+
-[ ] add metrics;
29
30
-[ ] add synchronization toolkit;
30
31
-[ ] support and compatibility for AF_XDP socket;
31
32
@@ -39,7 +40,7 @@ English | [中文](README_ZH.md)
39
40
open-coroutine = "x.y.z"
40
41
```
41
42
42
-
### step2: add macro
43
+
### step2: add `open_coroutine::main`macro
43
44
44
45
```rust
45
46
#[open_coroutine::main]
@@ -50,17 +51,39 @@ fn main() {
50
51
51
52
### step3: create a task
52
53
54
+
```rust
55
+
#[open_coroutine::main]
56
+
fnmain() {
57
+
_=open_coroutine::task!(|param| {
58
+
assert_eq!(param, "param");
59
+
}, "param");
60
+
}
61
+
```
62
+
63
+
### create a task with priority(optional)
64
+
65
+
```rust
66
+
#[open_coroutine::main]
67
+
fnmain() {
68
+
_=open_coroutine::task!(|param| {
69
+
assert_eq!(param, "param");
70
+
}, "param", 1/*the smaller the value, the higher the priority*/);
71
+
}
72
+
```
73
+
74
+
### wait until the task is completed or timed out(optional)
[](http://isitmaintained.com/project/acl-dev/open-coroutine"Average time to resolve an issue")
9
-
[](http://isitmaintained.com/project/acl-dev/open-coroutine"Percentage of issues still open")
8
+
[](http://isitmaintained.com/project/acl-dev/open-coroutine"解决issue的平均时间")
9
+
[](http://isitmaintained.com/project/acl-dev/open-coroutine"仍未关闭issue的百分比")
0 commit comments