> ## 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.

# Como: criar uma fila de tarefas de pool de threads

> Como: criar uma fila de tarefas de pool de threads

## Exemplo

O exemplo a seguir mostra como criar uma fila de tarefas que despacha os retornos de chamada de trabalho e de conclusão no pool de threads do sistema.

```c++ theme={null}
void CreatingTaskQueue()  
{  
    XTaskQueueHandle queue;  
 
    HRESULT hr = XTaskQueueCreate(  
        XTaskQueueDispatchMode::ThreadPool,  
        XTaskQueueDispatchMode::ThreadPool,  
        &queue);  
 
    if (FAILED(hr))  
    { 
        printf("Creating queue failed: 0x%x\r\n", hr);  
        return;  
    }  
 
    SubmitCallbacks(queue); 
 
    // Wait a while for the callbacks to run.  
    Sleep(1000);  
 
    XTaskQueueTerminate(queue, true, nullptr, nullptr);  
}  
```

## Exemplo de saída

```
Worker invoked on thread 11440. Cancel? 0. 
Completion invoked on thread 11440. Cancel? 0.  
```

## Consulte também

[Projetando a fila de tarefas](/pt-BR/build/core-features/common/async/async-task-queue-design)


## Related topics

- [Notas de versão do SDK C++ do PlayFab Multiplayer](/pt-BR/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [XR-074 Perda de conectividade com os serviços XBOX e de parceiros](/pt-BR/publishing/certification/xr/xr-074.md)
- [Portar de uma geração anterior de XBOX](/pt-BR/paths/porting/from-xbox-era.md)
- [Notas de versão do PlayFab Party](/pt-BR/services/playfab/multiplayer/networking/release-notes.md)
- [Documentação de desenvolvimento de jogos XBOX](/pt-BR/index.md)
