Skip to content

Examples ​

All FastQueue examples with complete, runnable code.

Thread Pool ​

ExampleDescription
Basic JobsSubmit and execute simple tasks
Parallel ForParallel data processing

Scheduler ​

ExampleDescription
Scheduler BasicsLow-level scheduler usage
Work StealingDemonstrate work stealing

Futures ​

ExampleDescription
FuturesAwaitable task results
Multiple FuturesWait for multiple tasks

Memory ​

ExampleDescription
Custom AllocatorPluggable allocator interface

Patterns ​

ExampleDescription
Graceful ShutdownClean shutdown patterns
Error HandlingError handling best practices

C++ Usage ​

All examples work in C++ with extern "C" compatibility:

cpp
#include <fastqueue/fastqueue.h>
#include <cstdio>

int main()
{
    fq_thread_pool_t *pool = nullptr;
    fq_thread_pool_create_ex(&pool, 4);
    // ... same API as C
    fq_thread_pool_shutdown(pool);
    return 0;
}

Released under the MIT License.