GATE
|
Thread pool implementation. More...
Functions | |
GATE_CORE_API gate_result_t | gate_threadpool_create (gate_threadpool_t *ptr_pool, gate_uint32_t thread_count, gate_uint32_t max_tasks) |
Allocates resources for a threadpool. | |
GATE_CORE_API gate_result_t | gate_threadpool_start (gate_threadpool_t pool) |
Starts task processing within the thread pool. | |
GATE_CORE_API gate_result_t | gate_threadpool_stop (gate_threadpool_t pool) |
Stops task processing within the thread pool. | |
GATE_CORE_API gate_result_t | gate_threadpool_destroy (gate_threadpool_t pool) |
Deallocates resources of the threadpool and releases its handle. | |
GATE_CORE_API gate_result_t | gate_threadpool_add_task (gate_threadpool_t pool, gate_runnable_t *task) |
Adds a runnable interface as a task to be processed by a free thread in the pool. | |
GATE_CORE_API gate_result_t | gate_threadpool_remove_task (gate_threadpool_t pool, gate_runnable_t *task) |
Removes a runnable interface from the list of pending tasks. | |
GATE_CORE_API gate_size_t | gate_threadpool_pending_tasks (gate_threadpool_t pool) |
Returns the current amount of pending tasks. | |
Thread pool implementation.
GATE_CORE_API gate_result_t gate_threadpool_create | ( | gate_threadpool_t * | ptr_pool, |
gate_uint32_t | thread_count, | ||
gate_uint32_t | max_tasks ) |
Allocates resources for a threadpool.
[in,out] | ptr_pool | pointer to threadpool handle to be initialized |
[in] | thread_count | amount of threads to be managed by this threadpool |
[in] | max_tasks | maximum amount of allowed pending tasks |
GATE_CORE_API gate_result_t gate_threadpool_start | ( | gate_threadpool_t | pool | ) |
Starts task processing within the thread pool.
[in] | pool | threadpool handle to be started |
GATE_CORE_API gate_result_t gate_threadpool_stop | ( | gate_threadpool_t | pool | ) |
Stops task processing within the thread pool.
[in] | pool | threadpool handle to be stopped |
GATE_CORE_API gate_result_t gate_threadpool_destroy | ( | gate_threadpool_t | pool | ) |
Deallocates resources of the threadpool and releases its handle.
[in] | pool | threadpool handle to be stopped |
GATE_CORE_API gate_result_t gate_threadpool_add_task | ( | gate_threadpool_t | pool, |
gate_runnable_t * | task ) |
Adds a runnable interface as a task to be processed by a free thread in the pool.
[in] | pool | threadpool handle to be accessed |
[in] | task | pointer to runnable interface representing the task to be executed |
GATE_CORE_API gate_result_t gate_threadpool_remove_task | ( | gate_threadpool_t | pool, |
gate_runnable_t * | task ) |
Removes a runnable interface from the list of pending tasks.
[in] | pool | threadpool handle to be accessed |
[in] | task | pointer to runnable interface representing the task to be removed |
GATE_CORE_API gate_size_t gate_threadpool_pending_tasks | ( | gate_threadpool_t | pool | ) |
Returns the current amount of pending tasks.
[in] | pool | threadpool handle to be accessed |