https://github.com/aosync/ctx
Context switching C library
https://github.com/aosync/ctx
c context-switching coroutines
Last synced: 2 months ago
JSON representation
Context switching C library
- Host: GitHub
- URL: https://github.com/aosync/ctx
- Owner: aosync
- License: mit
- Created: 2021-07-24T16:33:51.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-06T14:28:01.000Z (almost 2 years ago)
- Last Synced: 2025-12-31T01:59:22.842Z (6 months ago)
- Topics: c, context-switching, coroutines
- Language: Assembly
- Homepage:
- Size: 29.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ctx
ctx is C library providing a uniform interface to context switching facilities and stack allocation, similarly to ucontext. This library is geared towards the portable implementation of stackful coroutines.
The supported triplets of `architecture-abi-assembler` are listed in the `arch` directory.
## building and dependency
ctx is currently built using the Meson build system. The `main.c` test file can be built as follows
```
meson setup bld
meson compile -C bld
```
To add ctx as a dependency to your project using the Meson build system, create a *wrap* file for ctx named `ctx.wrap` in a `subprojects` directory, with the following contents
```
[wrap-git]
url = git@github.com:aosync/ctx
revision = head
```
Then, the dependency can be added to your meson.build file using, typically, the following scheme
```
ctx_dep = dependency('ctx', required : false)
if not ctx_dep.found()
ctx_proj = subproject('ctx')
ctx_dep = ctx_proj.get_variable('ctx_dep')
endif
```
Finally, `ctx_dep` can be added as a dependency to your targets.
## credits
- [musl setjmp](http://git.musl-libc.org/cgit/musl/tree/src/setjmp/)