---
title: 函数：synchronize_stream_with_timeout
description: "| C函数原型 | aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32\_t timeout) |"
url: https://www.hiascend.com/document/detail/zh/Atlas200IDKA2DeveloperKit/latest/Application%20Development%20Guide/aadgp/aclpythondevg_01_0097.html
sourcePath: /source/zh/Atlas200IDKA2DeveloperKit/23.0.RC2/Application Development Guide/aadgp/aclpythondevg_01_0097.html
indexId: ff71a3678328555b14558f93fbde9dce296dfdf84107b98db70849e6414007de108
---
# 函数：synchronize_stream_with_timeout

| C函数原型 | aclError aclrtSynchronizeStreamWithTimeout(aclrtStream stream, int32\_t timeout) |
| --- | --- |
| Python函数 | ret = acl.rt.synchronize\_stream\_with\_timeout(stream, timeout) |
| 函数功能 | 阻塞应用程序运行，直到指定Stream中的所有任务都完成，该接口是在acl.rt.synchronize\_stream接口基础上进行了增强，支持用户设置超时时间，当应用程序异常时可根据所设置的超时时间自行退出。同步接口。 |
| 输入说明 | stream：int，指定需要完成所有任务的Stream的指针地址。 timeout：int，接口的超时时间。取值说明如下： \-1：表示永久等待，和接口acl.rt.synchronize\_stream功能一样。 >0：配置具体的超时时间，单位是毫秒。 |
| 返回值说明 | ret：int，错误码。 返回0表示成功。 返回其它值表示失败。 |
| 约束说明 | 无 |
