An implementation of green threads in c, with c++ templates, for x86_64 processors.
Two synchronization primitives are provided
- Semaphore: Allow a number of concurrent fibers
- Barrier: All waiting fibers are released at once
czsf_wait() on a sync primitive must be called from a fiber.
Iinclude the following snippet in one source file:
#define CZSF_IMPLEMENTATION
#include "czsf.h"Based on the presentation Parallelizing the Naughty Dog Engine Using Fibers.
Linux:
g++ example.cpp -pthread