> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Wait

> Queues a GPU-side wait, and returns immediately. A GPU-side wait is where the GPU waits until the specified fence reaches or exceeds the specified value.

Queues a GPU-side wait, and returns immediately. A GPU-side wait is where the GPU waits until the specified fence reaches or exceeds the specified value.

## Syntax

```cpp theme={null}
HRESULT Wait(
    ID3D12Fence  pFence,
    UINT64 Value
)
```

### Parameters

*pFence*\
Type: ID3D12Fence \*

A pointer to the [ID3D12Fence](/reference/graphics/d3d12/interfaces/id3d12fence/id3d12fence_public) object.

*Value*\
Type: UINT64

The value that the command queue is waiting for the fence to reach or exceed.  So when  [ID3D12Fence::GetCompletedValue](/reference/graphics/d3d12/interfaces/id3d12fence/methods/id3d12fence_getcompletedvalue_public) is greater than or equal to <i>Value</i>, the wait is terminated.

### Return value

Type: HRESULT

This method returns one of the [Direct3D 12 Return Codes](https://learn.microsoft.com/en-us/windows/win32/direct3d12/d3d12-graphics-reference-returnvalues).

## Remarks

Because a wait is being queued, the API returns immediately. It's the command queue that waits (during which time no work is executed) until the fence specified reaches the requested value.

If you want to perform a CPU-side wait (where the calling thread blocks until a fence reaches a particular value), then you should use the [**ID3D12Fence::SetEventOnCompletion**](/reference/graphics/d3d12/interfaces/id3d12fence/methods/id3d12fence_seteventoncompletion_public) API in conjunction with [**WaitForSingleObject**](https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-waitforsingleobject) (or a similar API).

## Requirements

**Header:** d3d12\_xs.h or d3d12\_x.h\
**Library:** d3d12\_xs.lib or d3d12\_x.lib\
**Supported Platforms**: XBOX Series consoles and XBOX One family

## See Also

[ID3D12CommandQueue](/reference/graphics/d3d12_xs/interfaces/ID3D12CommandQueue/id3d12commandqueue_xs)

[Multi-engine synchronization](https://learn.microsoft.com/en-us/windows/win32/direct3d12/user-mode-heap-synchronization)


## Related topics

- [D3D12_MULTIPLE_FENCE_WAIT_FLAGS](/reference/graphics/d3d12/enums/d3d12_multiple_fence_wait_flags_public.md)
- [IGameInputDispatcher::OpenWaitHandle](/reference/input/gameinput/interfaces/IGameInputDispatcher/methods/igameinputdispatcher_openwaithandle.md)
- [XblMultiplayerManagerEstimatedMatchWaitTime](/reference/live/xsapi-c/multiplayer_manager_c/functions/xblmultiplayermanagerestimatedmatchwaittime.md)
- [XTaskQueueRegisterWaiter](/reference/system/xtaskqueue/functions/xtaskqueueregisterwaiter.md)
- [XTaskQueueUnregisterWaiter](/reference/system/xtaskqueue/functions/xtaskqueueunregisterwaiter.md)
