A simple educational async runtime implemented in C.
This project demonstrates how to build an asynchronous task executor from scratch using a worker thread pool and a future-based system. It is written entirely in C with POSIX threads and is intended for educational purposes only.
- Worker thread pool (autodetected based on CPU cores)
- Future-based asynchronous task API
- Callback support with
future_then() - Manual polling via
future_get()or automatic viaasync_run() - Event-loop-style task processing
- Static (
.a) and shared (.so) library builds - Clean, minimal API via
async.h
async/
├── include/ # Public API header (async.h)
├── src/ # Library implementation
├── example/ # Example usage
├── build/ # Compiled objects (auto-created)
├── Makefile
To build the static and shared libraries along with the example:
makeTo run the example:
LD_LIBRARY_PATH=. ./example/exampleTo clean the project:
make cleansudo cp libasync.so /usr/local/lib/
sudo cp include/async.h /usr/local/include/
sudo ldconfigThis is an educational project to explore how asynchronous systems work in C.
It is not production-ready and lacks proper error handling, timeout support, and thread safety guarantees for concurrent usage of futures.
Use it as a learning tool or starting point for deeper exploration.
MIT