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

# XAsyncProvider library overview

> XAsyncProvider library overview

This topic describes the purpose of the [XAsyncProvider](/reference/system/xasyncprovider/xasyncprovider_members) 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](/reference/system/xasync/structs/xasyncblock)
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](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods) and
[allowing async tasks to be cancelable](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability).

<a id="async_provider_callback" />

#### 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](/reference/system/xasyncprovider/functions/xasyncbegin) 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.

<img src="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" alt="Screenshot of a simplified illustration of a provider handling a task" width="662" height="355" data-path="images/gdk/features/common/async_provider_diagram.png" />

## Reference API documentation

* [XAsyncProvider (API contents)](/reference/system/xasyncprovider/xasyncprovider_members)
  * Functions
    * [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin)
* [xasync (API contents)](/reference/system/xasync/xasync_members)
  * Structures
    * [XAsyncBlock](/reference/system/xasync/structs/xasyncblock)

## See also

[Set up custom provider (example)](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider)

[Set up invocation methods (example)](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods)

[Set up return data (example)](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data)

[Set up cancelability (example)](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability)

[XAsyncProvider](/reference/system/xasyncprovider/xasyncprovider_members)


## Related topics

- [XAsyncProvider](/reference/system/xasyncprovider/xasyncprovider_members.md)
- [XAsyncBegin](/reference/system/xasyncprovider/functions/xasyncbegin.md)
- [Set up return data example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data.md)
- [Set up invocation methods example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-invocation-methods.md)
- [Set up cancelability example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
