Sets the given task queue as the process wide task queue.


void XTaskQueueSetCurrentProcessTaskQueue(  
         XTaskQueueHandle queue  


queue   _In_
Type: XTaskQueueHandle

The queue to set up as the default task queue for the procces.

Return value

Type: void



This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

The queue can be set to nullptr, in which case XTaskQueueGetCurrentProcessTaskQueue will also return nullptr. The provided queue will have its handle duplicated and any existing process task queue will have its handle closed.

The following example replaces the default process task queue. This task queue uses the thread pool for both work and completion dispatching. Microsoft Game Development Kit (GDK) APIs that take task queue parameters all accept nullptr and substitute the process task queue. The process task queue can also be set to nullptr, in which case Microsoft Game Development Kit (GDK) APIs that require a task queue parameter will error with E_NO_TASK_QUEUE if null was provided. This allows Microsoft Game Development Kit (GDK) APIs to function with defaults while still allowing tight control over task queue handles if needed.

void UsingProcessTaskQueue()
    XTaskQueueHandle queue = nullptr;

    auto callback = [](void*, bool)
        printf("Work callback invoked.\r\n");

    HRESULT hr = XTaskQueueSubmitCallback(
        queue, XTaskQueuePort::Work, 
        nullptr, callback);

    if (FAILED(hr))
        printf("Failed to submit callback: %x\r\n", hr);

    // You can replace the process task queue.
    hr = XTaskQueueCreate(

    if (FAILED(hr))
        printf("Failed to create new task queue: %x\r\n", hr);


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