---
title: aclrtSynchronizeStreamWithTimeout
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclcppdevg_03_0077.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclcppdevg_03_0077.html
indexId: 8287eb259c7efdb9a97ba391c6df7e0c45a5f16f14c4ae13210f4420f376d12b68
---
# aclrtSynchronizeStreamWithTimeout

#### 产品支持情况

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


#### 功能说明

阻塞Host侧当前线程直到指定Stream中的所有任务都完成，该接口是在aclrtSynchronizeStream接口基础上进行了增强，支持用户设置超时时间，当应用程序异常时可根据所设置的超时时间自行退出。


#### 函数原型

```
aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32_t timeout)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| stream | 输入 | 指定需要完成所有任务的Stream。类型定义请参见aclrtStream。 |
| timeout | 输入 | 接口的超时时间。 取值说明如下： \-1：表示永久等待，和接口aclrtSynchronizeStream功能一样； >0：配置具体的超时时间，单位是毫秒。 |


#### 返回值说明

返回0表示成功，返回其他值表示失败，请参见aclError。
