47#if defined(QSC_SYSTEM_OS_WINDOWS)
52 typedef HANDLE qsc_mutex;
53 typedef HANDLE qsc_thread;
54#elif defined(QSC_SYSTEM_OS_POSIX)
55 #include <sys/types.h>
58 typedef pthread_mutex_t qsc_mutex;
59 typedef pthread_t qsc_thread;
61 #error your operating system is not supported!
64QSC_CPLUSPLUS_ENABLED_START
100#define QSC_ASYNC_PARALLEL_MAX 128ULL
279QSC_CPLUSPLUS_ENABLED_END
QSC_EXPORT_API qsc_mutex qsc_async_mutex_lock_ex(void)
Create and lock a mutex.
Definition async.c:183
QSC_EXPORT_API int32_t qsc_async_thread_suspend(qsc_thread handle)
Suspend a thread.
Definition async.c:310
QSC_EXPORT_API void qsc_async_thread_wait(qsc_thread handle)
Wait for a thread to complete execution.
Definition async.c:348
QSC_EXPORT_API qsc_mutex qsc_async_mutex_create(void)
Create a mutex.
Definition async.c:144
QSC_EXPORT_API qsc_thread qsc_async_thread_create_ex(void(*func)(void **), void **args)
Create a thread with multiple parameters.
Definition async.c:249
QSC_EXPORT_API void qsc_async_thread_sleep(uint32_t msec)
Suspend the calling thread for a specified number of milliseconds.
Definition async.c:295
QSC_EXPORT_API void qsc_async_mutex_unlock(qsc_mutex mtx)
Unlock a mutex.
Definition async.c:193
QSC_EXPORT_API bool qsc_async_mutex_destroy(qsc_mutex mtx)
Destroy a mutex.
Definition async.c:159
QSC_EXPORT_API void qsc_async_launch_thread(void(*func)(void *), void *state)
Launch a function on a new thread.
Definition async.c:103
QSC_EXPORT_API void qsc_async_launch_parallel_threads(void(*func)(void *), size_t count,...)
Launch multiple threads in parallel using variadic arguments.
Definition async.c:119
QSC_EXPORT_API qsc_thread qsc_async_thread_create(void(*func)(void *), void *state)
Create a thread with one parameter.
Definition async.c:224
QSC_EXPORT_API void qsc_async_thread_wait_time(qsc_thread handle, uint32_t msec)
Wait for a thread to complete execution with a timeout.
Definition async.c:361
QSC_EXPORT_API void qsc_async_thread_wait_all(qsc_thread *handles, size_t count)
Wait for an array of threads to complete execution.
Definition async.c:374
QSC_EXPORT_API bool qsc_async_thread_terminate(qsc_thread handle)
Terminate a thread.
Definition async.c:332
QSC_EXPORT_API int32_t qsc_async_thread_resume(qsc_thread handle)
Resume a suspended thread.
Definition async.c:275
QSC_EXPORT_API void qsc_async_mutex_unlock_ex(qsc_mutex mtx)
Unlock and destroy a mutex.
Definition async.c:202
QSC_EXPORT_API void qsc_async_mutex_lock(qsc_mutex mtx)
Lock a mutex.
Definition async.c:174
QSC_EXPORT_API size_t qsc_async_processor_count(void)
Get the number of processor cores available.
Definition async.c:208
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 common.h:520
#define QSC_SYSTEM_CONDITION_IGNORE(x)
MSVC-specific macro to disable a specific warning condition.
Definition common.h:784