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

# Set up invocation methods example

> Set up invocation methods example

This topic provides an example of how to set up invocation methods for a custom provider. When working with custom async providers, it's best to use invocation
methods so that the provider can be reused as needed.

```c++ theme={null}
HRESULT CustomProviderMethodAsync(XAsyncBlock* async)
{
    // Set up the context for your method.
    void* context;
    HRESULT hr = XAsyncBegin(async, context, CustomProviderMethodAsync, __FUNCTION__,
        [](XAsyncOp op, const XAsyncProviderData* providerData)
        {
            // Provider cases are handled here.
            return S_OK;
        });
    return hr;
}
```

This example shows how all asynchronous Microsoft Game Development Kit (GDK) methods are implemented and
allows for reuse of the provider. If the `DoWork` case is highly
specific, it becomes a specialized asynchronous function. To make
it generic, allow the `DoWork` case to be customized in some way.

## Reference API documentation

* [XAsyncProvider (API contents)](/reference/system/xasyncprovider/xasyncprovider_members)

## See also

[XAsyncProvider library overview](/build/core-features/common/async/async-libraries/async-library-xasyncprovider)

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

[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

- [Set up cancelability example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
- [XAsyncProvider library overview](/build/core-features/common/async/async-libraries/async-library-xasyncprovider.md)
- [XAsync libraries for asynchronous task programming](/build/core-features/common/async/async-libraries/index.md)
- [Set up return data example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-return-data.md)
- [Set up async task example](/build/core-features/common/async/async-libraries/async-library-xasync-example-setup-async-task.md)
