Create task queue example

Important

XBOX Docs are now on docs.xbox.com! This page is kept as an archive and is no longer being updated. Visit our documentation on docs.xbox.com for the latest information and updates.

Visit the latest docs on docs.xbox.com

This topic provides an example of how to create a task queue. Simply call XTaskQueueCreate, pass in the modes for each port, and then save the created handle.

XTaskQueueHandle taskQueue1;
HRESULT hr = XTaskQueueCreate(
    XTaskQueueDispatchMode::ThreadPool,
    XTaskQueueDispatchMode::Manual,
    &taskQueue1);

XTaskQueueHandle taskQueue2;
hr = XTaskQueueCreate(
    XTaskQueueDispatchMode::Immediate,
    XTaskQueueDispatchMode::SerializedThreadPool,
    &taskQueue2);

If there isn't an error with the return code, the task queue is now represented by the returned XTaskQueueHandle.

Reference API documentation

See also

XTaskQueue library overview

Dispatch task queue (example)

Clean up task queue (example)

Designing the task queue

XTaskQueue