52#ifndef QSC_THREADPOOL_H
53#define QSC_THREADPOOL_H
58QSC_CPLUSPLUS_ENABLED_START
107#define QSC_THREADPOOL_THREADS_MAX 1024ULL
167QSC_CPLUSPLUS_ENABLED_END
Asynchronous Thread and Mutex Management Functions.
Contains common definitions for the Quantum Secure Cryptographic (QSC) library.
#define QSC_EXPORT_API
API export macro for Microsoft compilers when importing from a DLL.
Definition qsccommon.h:605
#define QSC_SYSTEM_CONDITION_IGNORE(x)
A macro to disable a specific warning condition.
Definition qsccommon.h:851
The thread pool state.
Definition threadpool.h:114
qsc_thread tpool[QSC_THREADPOOL_THREADS_MAX]
Definition threadpool.h:115
volatile int32_t tcount
Definition threadpool.h:116
QSC_EXPORT_API void qsc_threadpool_initialize(qsc_threadpool_state *ctx)
Initialize the thread-pool.
Definition threadpool.c:62
QSC_EXPORT_API void qsc_threadpool_sort(qsc_threadpool_state *ctx)
Sort the threads in the pool, placing active threads at the start of the array.
Definition threadpool.c:74
QSC_EXPORT_API bool qsc_threadpool_thread_active(const qsc_threadpool_state *ctx, size_t index)
Check if a thread is active.
Definition threadpool.c:106
QSC_EXPORT_API void qsc_threadpool_destroy(qsc_threadpool_state *ctx)
Clear all tasks from the thread-pool and dispose of the state.
Definition threadpool.c:38
#define QSC_THREADPOOL_THREADS_MAX
The thread pool maximum threads.
Definition threadpool.h:107
QSC_EXPORT_API bool qsc_threadpool_add_task(qsc_threadpool_state *ctx, void(*func)(void *), void *state)
Add a task to the thread-pool.
Definition threadpool.c:6
QSC_EXPORT_API void qsc_threadpool_remove_task(qsc_threadpool_state *ctx, size_t index)
Remove a task from the thread-pool.
Definition threadpool.c:127