Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. C/C++
  3. Neco

Neco

MITC

A lightweight C library for concurrency using stackful coroutines, designed for easy concurrent I/O and network programming.

GitHubGitHub
1.4k stars112 forks0 contributors

What is Neco?

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.

Target Audience

C developers building networked applications, embedded systems, or any project requiring efficient concurrent I/O without the overhead of multi-threading.

Value Proposition

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.

Overview

Concurrency library for C (coroutines)

Use Cases

Best For

  • Building concurrent network servers like HTTP or TCP echo servers
  • Writing lightweight coroutine-based I/O handlers in C applications
  • Implementing generators or iterators using coroutines
  • Creating deterministic, single-threaded concurrent systems
  • Adding concurrency to embedded or resource-constrained environments
  • Prototyping concurrent algorithms with a simple synchronization model

Not Ideal For

  • Applications requiring true parallelism across multiple CPU cores
  • Projects heavily dependent on Windows or WebAssembly for full networking and I/O capabilities
  • Teams that prefer async/await syntax over coroutine-based concurrency models
  • Systems needing direct use of pthread synchronization primitives within coroutines

Pros & Cons

Pros

Lightning-Fast Context Switching

Uses assembly for user-space context switches, achieving ~11 nanoseconds per switch on modern hardware like AMD Ryzen, as benchmarked in the README.

Zero-Dependency Simplicity

Just drop neco.c and neco.h into your project with no external libraries or complex build steps, making integration trivial.

Posix Interoperability

Designed to work seamlessly with existing Posix file descriptors and functions, easing adoption in legacy C codebases.

Rich Synchronization Toolkit

Includes channels, generators, mutexes, and condition variables inspired by Go, providing robust tools for coroutine coordination.

Deterministic Scheduling

Features a fair scheduler that ensures predictable execution order, beneficial for debugging and deterministic systems.

Cons

Platform-Specific Limitations

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.

Single-Threaded Runtime

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.

No Native Multithreading

The library explicitly avoids multithreaded coroutine scheduling, making it unsuitable for applications that need to leverage multiple CPU cores directly.

Argument Scope Complexity

Coroutine arguments must be copied before the first neco_ function call, adding overhead and potential for use-after-free bugs if not handled carefully.

Frequently Asked Questions

Quick Stats

Stars1,350
Forks112
Contributors0
Open Issues6
Last commit1 year ago
CreatedSince 2024

Tags

#systems-programming#c-library#embedded#coroutines#network-programming#io#cross-platform#concurrency#synchronization

Built With

a
assembly
C
C++

Included in

C/C++70.6k
Auto-fetched 1 day ago

Related Projects

concurrentqueueconcurrentqueue

A fast multi-producer, multi-consumer lock-free concurrent queue for C++11

Stars12,229
Forks1,916
Last commit25 days ago
TaskflowTaskflow

A General-purpose Task-parallel Programming System in C++

Stars11,949
Forks1,396
Last commit2 days ago
ThreadPoolThreadPool

A simple C++11 Thread Pool implementation

Stars8,734
Forks2,352
Last commit1 year ago
ArrayFireArrayFire

ArrayFire: a general purpose GPU library.

Stars4,883
Forks548
Last commit1 month ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub