我要评分
获取效率
正确性
完整性
易理解

HTL_thread_pool_pop

Pops up the worker from the pool.

Interface Definition

int HTL_thread_pool_pop(HTL_thread_pool_t thread_pool, HTL_worker_t *worker);

Description

HTL_thread_pool_pop() pops up the worker from the pool specified by thread_pool and sets it as worker.

If the function successfully pops up the worker, the function set worker to the obtained HTL_worker_t handle. Otherwise, this function sets worker to HTL_THREAD_WORKER_NULL.

Parameters

Parameter

Type

Description

Input/Output

thread_pool

HTL_thread_pool_t

Handle to the thread pool.

Input

worker

HTL_worker_t *

Address of the handle to the worker.

Output

Return Value

  • HTL_THREAD_SUCCESS: success.
  • Other values: failure. For details, see the error code descriptions.

Example

1
2
3
4
5
    int num_pools;
    HTL_thread_pool_t *pools;
    pools = (HTL_thread_pool_t *)malloc(num_pools * sizeof(HTL_thread_pool_t));
    HTL_thread_scheduler_get_pools(sched, num_pools, 0, pools);
    HTL_thread_pool_pop(pools[0], &worker);