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

# XAsyncCancel

> XAsyncCancel

Attempts to cancel an asynchronous call.

## Syntax

```cpp theme={null}
void XAsyncCancel(  
         XAsyncBlock* asyncBlock  
)  
```

### Parameters

*asyncBlock*   \_Inout\_\
Type: [XAsyncBlock\*](https://docs.xbox.com/reference/system/xasync/structs/xasyncblock.md)

A pointer to the [XAsyncBlock](https://docs.xbox.com/reference/system/xasync/structs/xasyncblock.md) for the asynchronous call.

### Return value

Type: void

## Remarks

If the `XAsyncCancel` function is invoked for an asynchronous call that has not yet completed, the [XAsyncGetResult](https://docs.xbox.com/reference/system/xasyncprovider/functions/xasyncgetresult.md), [XAsyncGetResultSize](https://docs.xbox.com/reference/system/xasync/functions/xasyncgetresultsize.md), and [XAsyncGetStatus](https://docs.xbox.com/reference/system/xasync/functions/xasyncgetstatus.md) functions return `E_ABORT` and completion of the asynchronous call is signalled. Cancellation may happen synchronously, asynchronously, or not at all, depending on the call being canceled. If a completion callback was specified for the asynchronous call, it is then invoked. For more information about completion callbacks, see [XAsyncCompletionRoutine](https://docs.xbox.com/reference/system/xasync/functions/xasynccompletionroutine.md).

If the `XAsyncCancel` function is invoked for an asynchronous call that has already completed, nothing happens.

## Requirements

**Header:** XAsync.h

**Library:** xgameruntime.lib

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

## Conceptual documentation

* [XAsync library overview](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasync.md)
* [Set up cancelability](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
* [Set up custom provider](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider.md)
* [Asynchronous Programming Model](https://docs.xbox.com/build/core-features/common/async/async-programming-model.md)

## See also

[XAsyncCompletionRoutine](https://docs.xbox.com/reference/system/xasync/functions/xasynccompletionroutine.md)\
[XAsync Members](https://docs.xbox.com/reference/system/xasync/xasync_members.md)\
[Asynchronous Programming Model](https://docs.xbox.com/build/core-features/common/async/async-programming-model.md)


## Related topics

- [Set up cancelability](https://docs.xbox.com/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
- [XAsync (API contents)](https://docs.xbox.com/reference/system/xasync/xasync_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)
- [Game Saves offline mode](https://docs.xbox.com/services/playfab/player-progression/game-saves/offline.md)
- [PFMultiplayerServerPingQosServersAsync](https://docs.xbox.com/services/playfab/api-references/c/pfmultiplayerserverqos/functions/pfmultiplayerserverpingqosserversasync.md)
