---
title: HTL_thread_pool_pop
description: "从池中弹出工作单元。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0079.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0079.html
indexId: 86bffcb5f8da973f5fbaf3ff6d73872dc2023bf909e0be511068ca4cc45dec7d74
---
# HTL_thread_pool_pop

从池中弹出工作单元。

#### 接口定义

int HTL_thread_pool_pop(HTL_thread_pool_t thread_pool, HTL_worker_t *worker);


#### 描述

HTL_thread_pool_pop()从池thread_pool中弹出工作单元，并将其设置为worker。

如果函数成功弹出工作单元，则会将worker设置为获得的HTL_worker_t句柄。否则，此例程将worker设置为HTL_THREAD_WORKER_NULL。


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| thread\_pool | HTL\_thread\_pool\_t | 线程池句柄。 | 输入 |
| worker | HTL\_worker\_t \* | 工作单元句柄地址。 | 输出 |


#### 返回值

- HTL_THREAD_SUCCESS：成功。
- 其他：失败。见错误码定义。


#### 示例

```
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);
```
