Skip to main content

XTaskQueueSubmitDelayedCallback

Submits a callback to the queue for the given port.

Syntax

Parameters

queue   _In_
Type: XTaskQueueHandle
The queue to submit the callback to. port   _In_
Type: XTaskQueuePort
The port to submit the callback to. Callbacks can be assigned to work or completion ports. delayMs   _In_
Type: uint32_t
The number of milliseconds to delay before submitting the callback to the queue.
A callback can be submitted to be added to the queue some time in the future. If delayMs is non-zero the callback will be placed on a pending list and a timer is initialized with the next closest wait time. When the time elapses, the callback with the next time will be placed on the execution list. The queue will raise a XTaskQueueMonitorCallback, and if the queue is running in a thread pool dispatch mode, thread pool work will be submitted.
callbackContext   _In_opt_
Type: void*
An optional context pointer that will be passed to the callback. callback   _In_
Type: XTaskQueueCallback*
A pointer to the callback function.

Return value

Type: HRESULT HRESULT success or error code.

Remarks

This callback will be added to the queue after delayMs milliseconds. alert Performance Note:
Adding an item to a queue needs to be lock and wait free in order to satisfy the performance requirements of upstream code. The following APIs are lock free:
The following example allows callbacks to be submitted in the future by using the XTaskQueueSubmitDelayedCallback function. This is a great way to retry a failed call after a short delay; it can also be used as a cheap timer for periodic events.
SubmitCallback is a helper function that is defined in the code example for the XTaskQueueSubmitCallback function.

Requirements

Header: XTaskQueue.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consoles

See also

XTaskQueue members
Asynchronous Programming Model
Async Task Queue design
Last modified on August 20, 2026