HTL_thread_executor_run_worker
执行工作单元。
接口定义
int HTL_thread_executor_run_worker(HTL_worker_t worker, HTL_thread_pool_t thread_pool);
描述
HTL_thread_executor_run_worker()将工作单元worker与线程池thread_pool关联,将worker作为子ULT运行在正在调用的ULT上,调用的ULT成为父ULT。当worker完成或退出时,调用的ULT恢复运行。
参数
参数名 |
类型 |
描述 |
输入/输出 |
|---|---|---|---|
worker |
HTL_worker_t |
工作单元句柄。 |
输入 |
thread_pool |
HTL_thread_pool_t |
线程池句柄。 |
输入 |
返回值
- HTL_THREAD_SUCCESS:成功。
- 其他:失败。见错误码定义。
示例
HTL_worker_t unit;
while (1) {
/* Execute one work unit from the scheduler's pool */
HTL_thread_pool_pop(pools[0], &unit);
if (unit != HTL_THREAD_WORKER_NULL) {
HTL_thread_executor_run_worker(unit, pools[0]);
}
...
}
父主题: 执行器函数