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

# XAsyncProvider library overview

> XAsyncProvider controls how async tasks run, enqueuing XAsyncBlock callbacks onto task queues, handling cancelability, and setting up result buffers.

This topic describes the purpose of the [XAsyncProvider](https://docs.xbox.com/reference/system/xasyncprovider/xasyncprovider_members.md) library. It's the most advanced of the
three asynchronous libraries and deals with how tasks are run. For example,
`XAsyncProvider` manages the actual behavior of taking an [XAsyncBlock](https://docs.xbox.com/reference/system/xasync/structs/xasyncblock.md)
and enqueuing the callbacks onto any task queues, handles cancelability,
and sets up result buffers.

In general, the `XAsyncProvider` library is optional and not needed for most cases because
a provider is usually already provided. However, the library can be used when
more advanced behavior is needed such as [creating APIs in the Microsoft Game Development Kit (GDK)
style](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods.md) and
[allowing async tasks to be cancelable](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md).

#### Async provider callback library

Most of the behavior of this library is centered around the
implementation of an async provider callback passed to the
[XAsyncBegin](https://docs.xbox.com/reference/system/xasyncprovider/functions/xasyncbegin.md) function. This callback represents the entire
flow of an async call from start to finish and handles the different
state changes along the way. The following screenshot shows a simplified illustration of a provider handling a task.

![Screenshot of a simplified illustration of a provider handling a task](https://mintcdn.com/microsoft-4404708b/sIrPFR_ir_sNKVEv/images/gdk/features/common/async_provider_diagram.png?fit=max\&auto=format\&n=sIrPFR_ir_sNKVEv\&q=85\&s=7ebe8812b5a7a51d77b5544ee3a8be93)

## Reference API documentation

* [XAsyncProvider (API contents)](https://docs.xbox.com/reference/system/xasyncprovider/xasyncprovider_members.md)
  * Functions
    * [XAsyncBegin](https://docs.xbox.com/reference/system/xasyncprovider/functions/xasyncbegin.md)
* [xasync (API contents)](https://docs.xbox.com/reference/system/xasync/xasync_members.md)
  * Structures
    * [XAsyncBlock](https://docs.xbox.com/reference/system/xasync/structs/xasyncblock.md)

## See also

[Set up custom provider (example)](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider.md)

[Set up invocation methods (example)](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods.md)

[Set up return data (example)](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data.md)

[Set up cancelability (example)](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)

[XAsyncProvider](https://docs.xbox.com/reference/system/xasyncprovider/xasyncprovider_members.md)


## Related topics

- [XAsyncProvider (API contents)](https://docs.xbox.com/reference/system/xasyncprovider/xasyncprovider_members.md)
- [Set up custom provider](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider.md)
- [Set up return data](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data.md)
- [Set up cancelability](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
- [Set up invocation methods](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods.md)
