A lightweight C library for concurrency using stackful coroutines, designed for easy concurrent I/O and network programming.
Neco is a concurrency library for C that implements stackful coroutines, providing a simple way to write concurrent I/O and network applications. It solves the complexity of traditional threading by offering a lightweight, single-threaded runtime with a deterministic scheduler, making concurrent programming more accessible in C.
C developers building networked applications, embedded systems, or any project requiring efficient concurrent I/O without the overhead of multi-threading.
Developers choose Neco for its minimal footprint, fast performance, and straightforward API that mirrors familiar concurrency patterns from Go, all while maintaining full compatibility with existing Posix functions.
Concurrency library for C (coroutines)
Uses assembly for user-space context switches, achieving ~11 nanoseconds per switch on modern hardware like AMD Ryzen, as benchmarked in the README.
Just drop neco.c and neco.h into your project with no external libraries or complex build steps, making integration trivial.
Designed to work seamlessly with existing Posix file descriptors and functions, easing adoption in legacy C codebases.
Includes channels, generators, mutexes, and condition variables inspired by Go, providing robust tools for coroutine coordination.
Features a fair scheduler that ensures predictable execution order, beneficial for debugging and deterministic systems.
On Windows and WebAssembly, key features like neco_wait() for file descriptor polling are missing, and networking support is incomplete, as admitted in the README.
Each thread has its own scheduler, and coroutines cannot span multiple threads without complex I/O workarounds like pipes, limiting scalability on multi-core systems.
The library explicitly avoids multithreaded coroutine scheduling, making it unsuitable for applications that need to leverage multiple CPU cores directly.
Coroutine arguments must be copied before the first neco_ function call, adding overhead and potential for use-after-free bugs if not handled carefully.
A fast multi-producer, multi-consumer lock-free concurrent queue for C++11
A General-purpose Task-parallel Programming System in C++
A simple C++11 Thread Pool implementation
ArrayFire: a general purpose GPU library.
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.