---
title: HTL_thread_executor_set_cpubind
description: "将执行器绑定到目标CPU。"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0066.html
sourcePath: /source/zh/kunpengboostkithistory/2300/accel/kunpengaccel_ksl_16_0066.html
indexId: c1822c3df5908ddd14e093abfa4e68dec8e3247e38802626f344eca7b727bc3874
---
# HTL_thread_executor_set_cpubind

将执行器绑定到目标CPU。

#### 接口定义

int HTL_thread_executor_set_cpubind(HTL_thread_executor_t executor, int cpuid);


#### 描述

HTL_thread_executor_set_cpubind()将执行器绑定到CPU ID上，CPU ID对应于处理器索引。


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| executor | HTL\_thread\_executor\_t | 执行器句柄。 | 输入 |
| cpuid | int | CPU ID。 | 输入 |


#### 返回值

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


#### 示例

```
new_cpuid = (cpuid + 1) % num_executors;
ret = HTL_thread_executor_set_cpubind(executor, new_cpuid);
```
