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

# XAsyncCancel

> XAsyncCancel

# XAsyncCancel

Attempts to cancel an asynchronous call.

## Syntax

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

### Parameters

*asyncBlock*   \_Inout\_\
Type: [XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

A pointer to the [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 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](/reference/system/xasyncprovider/functions/xasyncgetresult), [XAsyncGetResultSize](/reference/system/xasync/functions/xasyncgetresultsize), and [XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus) 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](/reference/system/xasync/functions/xasynccompletionroutine).

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](/build/core-features/common/async/async-libraries/async-library-xasync)
* [Set up cancelability](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability)
* [Set up custom provider](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider)
* [Asynchronous Programming Model](/build/core-features/common/async/async-programming-model)

## See also

[XAsyncCompletionRoutine](/reference/system/xasync/functions/xasynccompletionroutine)\
[XAsync Members](/reference/system/xasync/xasync_members)\
[Asynchronous Programming Model](/build/core-features/common/async/async-programming-model)


## Related topics

- [Set up cancelability example](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
- [XAsync](/reference/system/xasync/xasync_members.md)
- [Asynchronous Programming Model](/build/core-features/common/async/async-programming-model.md)
- [XAsyncCompletionRoutine](/reference/system/xasync/functions/xasynccompletionroutine.md)
- [XAsync library overview](/build/core-features/common/async/async-libraries/async-library-xasync.md)
