Files
XCEngine/docs/api/rhi/fence/wait.md
2026-03-20 02:35:45 +08:00

36 lines
612 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# RHIFence::Wait
```cpp
virtual void Wait(uint64_t value) = 0;
```
阻塞当前线程,直到围栏值达到或超过指定值。此方法用于 CPU 端等待 GPU 完成特定任务。
**参数:**
- `value` - 要等待的围栏值
**返回:**
**线程安全**:❌
**复杂度**O(n),具体取决于 GPU 完成指定值所需时间
**示例**
```cpp
RHIFence* fence = device->CreateFence();
fence->Signal(500ULL);
// 执行其他 CPU 工作...
// 等待 GPU 完成到指定值
fence->Wait(500ULL);
// 继续后续处理
```
## 相关文档
- [RHIFence](fence.md) - 返回类总览