---
title: 函数：synchronize_stream_with_timeout
description: "| 产品 | 是否支持 |"
url: https://www.hiascend.com/document/detail/zh/canncommercial/latest/API/runtimeapi/aclpythondevg_01_0088.html
sourcePath: /source/zh/canncommercial/900/API/runtimeapi/aclpythondevg_01_0088.html
indexId: 9f094ad477668d507ecdb0eeb4dc61ab7003657763cc9a201ab77301ee2de9f571
---
# 函数：synchronize_stream_with_timeout

#### 产品支持情况

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


#### 功能说明

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


#### 函数原型

- C函数原型
  1 aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32_t timeout)

- python函数
  1 ret = acl.rt.synchronize_stream_with_timeout(stream, timeout)


#### 参数说明

| 参数名 | 说明 |
| --- | --- |
| stream | int，指定需要完成所有任务的Stream的指针地址。 |
| timeout | int，接口的超时时间。取值说明如下： \-1：表示永久等待，和接口acl.rt.synchronize\_stream功能一样。 >0：配置具体的超时时间，单位是毫秒。 |


#### 返回值说明

| 返回值 | 说明 |
| --- | --- |
| ret | int，错误码，返回0表示成功，返回其它值表示失败。 |
