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

尝试取消一个异步调用。

## Syntax

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

### Parameters

*asyncBlock*   \_Inout\_\
类型：[XAsyncBlock\*](/reference/system/xasync/structs/xasyncblock)

指向该异步调用的 [XAsyncBlock](/reference/system/xasync/structs/xasyncblock) 的指针。

### Return value

类型：void

## Remarks

如果对尚未完成的异步调用调用 `XAsyncCancel` 函数，[XAsyncGetResult](/reference/system/xasyncprovider/functions/xasyncgetresult)、[XAsyncGetResultSize](/reference/system/xasync/functions/xasyncgetresultsize) 和 [XAsyncGetStatus](/reference/system/xasync/functions/xasyncgetstatus) 函数将返回 `E_ABORT`，异步调用完成会被发出信号。取消可能同步发生、异步发生或根本不发生，具体取决于要取消的调用。如果为异步调用指定了完成回调，则会调用它。有关完成回调的详细信息，请参阅 [XAsyncCompletionRoutine](/reference/system/xasync/functions/xasynccompletionroutine)。

如果对已完成的异步调用调用 `XAsyncCancel` 函数，则不会发生任何操作。

## Requirements

**头文件：** XAsync.h

**库：** xgameruntime.lib

**受支持的平台：** Windows、XBOX One 系列主机和 XBOX Series 主机

## Conceptual documentation

* [XAsync 库概述](/build/core-features/common/async/async-libraries/async-library-xasync)
* [设置可取消性](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability)
* [设置自定义提供程序](/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider)
* [异步编程模型](/build/core-features/common/async/async-programming-model)

## See also

[XAsyncCompletionRoutine](/reference/system/xasync/functions/xasynccompletionroutine)\
[XAsync Members](/reference/system/xasync/xasync_members)\
[异步编程模型](/build/core-features/common/async/async-programming-model)


## Related topics

- [设置可取消性示例](/zh-CN/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-cancelability.md)
- [XAsync](/zh-CN/reference/system/xasync/xasync_members.md)
- [异步编程模型](/zh-CN/build/core-features/common/async/async-programming-model.md)
- [XAsyncCompletionRoutine](/zh-CN/reference/system/xasync/functions/xasynccompletionroutine.md)
- [XAsync 库概述](/zh-CN/build/core-features/common/async/async-libraries/async-library-xasync.md)
