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

# XTaskQueueDispatchMode

> XTaskQueueDispatchMode

Describes how task queue callbacks are processed.

## Syntax

```cpp theme={null}
typedef enum class XTaskQueueDispatchMode  : uint32_t  
{  
    Manual,  
    ThreadPool,  
    SerializedThreadPool,  
    Immediate  
} XTaskQueueDispatchMode  
```

## Constants

| Constant | Description |
| - | - |
| Manual | Callbacks are not automatically dispatched. Callbacks submitted to a port using this dispatch mode are queued, but must be dispatched manually by [XTaskQueueDispatch](https://docs.xbox.com/reference/system/xtaskqueue/functions/xtaskqueuedispatch.md). **Note:** If you have a thread that pumps Windows messages:<ul><li>Do not dispatch callbacks for the work port</li><li>If you dispatch callbacks for the completion port, you must continue to pump Windows messages for the thread</li></ul> For more information, see [Creating a manual task queue](https://docs.xbox.com/build/core-features/common/async/async-task-queue-design-howto/creating-manual-task-queue.md). |
| ThreadPool | Callbacks submitted to a port using this dispatch mode are queued and automatically dispatched on the system thread queue. The task queue executes the calls in parallel, taking a call to execute from the task queue in turn as thread pool threads become available. For more information about creating a thread pool task queue, see [Creating a thread pool task queue](https://docs.xbox.com/build/core-features/common/async/async-task-queue-design-howto/creating-thread-pool-task-queue.md). |
| SerializedThreadPool | Callbacks submitted to a port using this dispatch mode are queued and automatically dispatched on the system thread queue. Unlike `ThreadPool`, the task queue executes the calls in serial, one at a time, on the thread pool. |
| Immediate | Callbacks are not queued at all, but are executed immediately on the thread that submitted them. For an example that implements the immediate dispatch mode, see [Creating a composite task queue](https://docs.xbox.com/build/core-features/common/async/async-task-queue-design-howto/creating-composite-task-queue.md). |

## Remarks

This enumeration is used by [XTaskQueueCreate](https://docs.xbox.com/reference/system/xtaskqueue/functions/xtaskqueuecreate.md) to specify the dispatch modes for the work and completion ports of a task queue.

The work port and completion port can use different dispatch modes. For example, you can use the thread pool dispatch mode for the work port to automatically queue & execute callbacks in parallel on the system thread queue, and use the manual dispatch mode for the completion port to manually queue & execute callbacks on the Windows message loop thread. For more information, see [Using a task queue with a Windows message loop](https://docs.xbox.com/build/core-features/common/async/async-task-queue-design-howto/task-queue-windows-msg-loop.md).

## Requirements

**Header:** XTaskQueue.h

**Supported platforms:** Windows, XBOX One family consoles and XBOX Series consoles

## See also

[XTaskQueue members](https://docs.xbox.com/reference/system/xtaskqueue/xtaskqueue_members.md)\
[Asynchronous Programming Model](https://docs.xbox.com/build/core-features/common/async/async-programming-model.md)\
[Async Task Queue Design](https://docs.xbox.com/build/core-features/common/async/async-task-queue-design.md)


## Related topics

- [XTaskQueueDispatch](https://docs.xbox.com/reference/system/xtaskqueue/functions/xtaskqueuedispatch.md)
- [XTaskQueueCreate](https://docs.xbox.com/reference/system/xtaskqueue/functions/xtaskqueuecreate.md)
- [XTaskQueue (API contents)](https://docs.xbox.com/reference/system/xtaskqueue/xtaskqueue_members.md)
- [Making async calls in the PlayFab Unified SDK](https://docs.xbox.com/services/playfab/sdks/unified-sdk/async-model.md)
- [Making Async Calls](https://docs.xbox.com/services/playfab/sdks/c/async.md)
