https://github.com/mopp/cider
Just hobby Fiber library written in C
https://github.com/mopp/cider
Last synced: 4 months ago
JSON representation
Just hobby Fiber library written in C
- Host: GitHub
- URL: https://github.com/mopp/cider
- Owner: mopp
- License: mit
- Created: 2023-09-15T00:45:06.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-07T00:39:05.000Z (almost 2 years ago)
- Last Synced: 2025-06-06T03:07:52.870Z (about 1 year ago)
- Language: C
- Size: 35.2 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cider
Just hobby Fiber library written in C
## Examples
```c
static void hoge(size_t argc, void* _argv[]) {
log_debug("hoge: started. argc = %zd", argc);
await_sleep(argc);
record_step(argc);
log_debug("hoge: returning. argc = %zd", argc);
}
static void func(size_t argc, void* _argv[]) {
log_debug("func: started. argc = %zd", argc);
log_info("1st await");
await(async(hoge, 10, NULL));
log_info("1st awaited");
log_info("2nd await");
await(async(hoge, 2, NULL));
log_info("2nd awaited");
log_debug("func: returning. argc = %zd", argc);
}
int main(int argc, char* argv[]) {
log_info("Begin.");
cider_init();
join_ciders(
async(hoge, 20, NULL),
async(func, 0, NULL));
assert_steps(10, 2, 20);
log_info("Succeeded.");
return 0;
}
```
See the other tests in more details.
## How to develop
```console
make test
# To execute each test file.
make test/example && test/example
make clean
```
NOTE: It don't aware of the change of headers.
## TODOs
- Add more tests
- Improve readability
- Add Fiber local storage
- Introduce N Threads M Fibers model