---
title: HcommThreadFree
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/programug/commopdev/hcclopdevapi_07_0077.html
sourcePath: /source/zh/canncommercial/900/programug/commopdev/hcclopdevapi_07_0077.html
indexId: 7f0b44978b82c619463366dfe5c56ce43bbdf01807b0c9f409319922717085c075
---
# HcommThreadFree

#### 产品支持情况

| 产品 | 是否支持 |
| --- | --- |
| Atlas 350 加速卡 | √ |
| Atlas A3 训练系列产品 / Atlas A3 推理系列产品 | ☓ |
| Atlas A2 训练系列产品 / Atlas A2 推理系列产品 | ☓ |
| Atlas 200I/500 A2 推理产品 | ☓ |
| Atlas 推理系列产品 | ☓ |
| Atlas 训练系列产品 | ☓ |


#### 功能说明

使用HcommThreadAlloc接口申请的thread需要通过本接口进行释放。


#### 函数原型

```
HcommResult HcommThreadFree(const ThreadHandle* threads, uint32_t threadNum)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| threads | 输入 | 通信线程句柄 ThreadHandle类型的定义可参见ThreadHandle。 |
| threadNum | 输入 | 通信线程数量。 |


#### 返回值

HcommResult：接口成功返回0，其他失败。


#### 约束说明

只能释放HcommThreadAlloc接口申请的thread。


#### 调用示例

```
ThreadHandle thread[2];
HcommResult ret =  HcommThreadAlloc(COMM_ENGINE_AICPU_TS, 2, 3, thread);
HcommResult ret =  HcommThreadFree(thread, 2);
```
