事件类
More...
#include <device.h>
事件类
用于流之间的同步和异步操作的完成状态查询
Definition at line 513 of file device.h.
◆ Event()
| nndeploy::device::Event::Event |
( |
Device * |
device | ) |
|
◆ ~Event()
| virtual nndeploy::device::Event::~Event |
( |
| ) |
|
|
virtual |
◆ as()
template<typename T >
| T* nndeploy::device::Event::as |
( |
| ) |
|
|
inline |
类型转换模板函数
- Template Parameters
-
- Returns
- T* 转换后的指针
Definition at line 592 of file device.h.
◆ getDevice()
| virtual Device* nndeploy::device::Event::getDevice |
( |
| ) |
const |
|
virtual |
获取关联设备
- Returns
- Device* 设备指针
◆ getDeviceType()
◆ getNativeEvent()
| virtual void* nndeploy::device::Event::getNativeEvent |
( |
| ) |
|
|
virtual |
获取原生事件对象
- Returns
- void* 原生事件指针
◆ queryDone()
| virtual bool nndeploy::device::Event::queryDone |
( |
| ) |
|
|
virtual |
查询事件是否已完成
非阻塞地检查事件是否已经完成执行。这个方法允许应用程序在不阻塞当前线程的情况下 检查事件状态。
示例:
Event *
event = device->createEvent();
stream->recordEvent(event);
if (event->queryDone()) {
}
Event(Device *device)
构造函数
- Returns
- bool 如果事件已完成返回true,否则返回false
◆ synchronize()
| virtual base::Status nndeploy::device::Event::synchronize |
( |
| ) |
|
|
virtual |
同步等待事件完成
阻塞当前线程直到事件完成。这个方法用于确保在继续执行之前, 与事件相关的所有操作都已完成。
示例:
Event *
event = device->createEvent();
stream->recordEvent(event);
event->synchronize();
- Returns
- base::Status 操作状态,成功返回kStatusCodeOk
◆ device_
| Device* nndeploy::device::Event::device_ |
|
protected |
The documentation for this class was generated from the following file:
- /home/docs/checkouts/readthedocs.org/user_builds/nndeploy-zh/checkouts/latest/framework/include/nndeploy/device/device.h