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

#### 产品支持情况

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


#### 功能说明

阻塞指定Stream的运行，直到指定的Event完成，支持多个Stream等待同一个Event的场景。异步接口。

提交到Stream上的所有后续任务都需要等待Event捕获的任务都完成后才能开始执行。具体见aclrtRecordEvent接口了解Event捕获的细节。


#### 函数原型

```
aclError aclrtStreamWaitEvent(aclrtStream stream, aclrtEvent event)
```


#### 参数说明

| 参数名 | 输入/输出 | 说明 |
| --- | --- | --- |
| stream | 输入 | 指定Stream。类型定义请参见aclrtStream。 多Stream同步等待场景下，例如，Stream2等待Stream1的场景，此处配置为Stream2。 |
| event | 输入 | 需等待的Event。类型定义请参见aclrtEvent。 |


#### 返回值说明

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


#### 约束说明

一个进程内，调用aclInit接口初始化后，若再调用aclrtSetOpWaitTimeout接口设置超时时间，那么本进程内后续调用aclrtStreamWaitEvent接口下发的任务支持在所设置的超时时间内等待，若等待的时间超过所设置的超时时间，则在调用同步等待接口（例如，aclrtSynchronizeStream）后，会返回报错。


#### 接口调用示例

接口调用示例，参见Event等待(https://www.hiascend.comdocument/detail/zh/canncommercial/900/programug/acldevg/runtime_doc_dev_0026.html)。
