Examples
All FastQueue examples with complete, runnable code.
Thread Pool
| Example | Description |
|---|---|
| Basic Jobs | Submit and execute simple tasks |
| Parallel For | Parallel data processing |
Scheduler
| Example | Description |
|---|---|
| Scheduler Basics | Low-level scheduler usage |
| Work Stealing | Demonstrate work stealing |
Futures
| Example | Description |
|---|---|
| Futures | Awaitable task results |
| Multiple Futures | Wait for multiple tasks |
Memory
| Example | Description |
|---|---|
| Custom Allocator | Pluggable allocator interface |
Patterns
| Example | Description |
|---|---|
| Graceful Shutdown | Clean shutdown patterns |
| Error Handling | Error 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;
}