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

# XAsyncSchedule

> XAsyncSchedule

# XAsyncSchedule

为异步提供程序的回调函数计划工作。

## Syntax

```cpp theme={null}
HRESULT XAsyncSchedule(  
         XAsyncBlock* asyncBlock,  
         uint32_t delayInMs  
)  
```

### Parameters

*asyncBlock*   \_Inout\_\
类型：[XAsyncBlock\*](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md)

指向为异步调用传递给 [XAsyncBegin](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/functions/xasyncbegin.md) 的 [XAsyncBlock](https://docs.xbox.com/zh-CN/reference/system/xasync/structs/xasyncblock.md) 的指针。

*delayInMs*   \_In\_\
类型：uint32\_t

系统在向异步队列计划异步调用之前应等待的时长（以毫秒为单位）。

### Return value

类型：[HRESULT](https://learn.microsoft.com/openspecs/windows_protocols/ms-erref/0642cb2f-2075-4469-918c-4441e69c548a)

成功时返回 `S_OK`；否则，返回错误代码。有关错误代码列表，请参阅[错误代码](https://docs.xbox.com/zh-CN/reference/errorcodes.md)。

## Remarks

此函数是可选的，可对异步提供程序的异步工作计划提供更多控制。如果异步工作可以通过系统管理的异步机制（例如[重叠 I/O](https://learn.microsoft.com/windows/win32/api/minwinbase/ns-minwinbase-overlapped?redirectedfrom=MSDN)）来完成，则无需调用此函数。

如果应在延迟后计划异步工作，请在 *delayInMs* 中指定 [XAsyncSchedule](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/functions/xasyncschedule.md) 在计划异步工作之前应等待的毫秒数。

有关使用 `XAsyncSchedule` 计划异步工作的异步提供程序示例，请参阅[异步编程模型](https://docs.xbox.com/zh-CN/build/core-features/common/async/async-programming-model.md#heading-7)中的"异步库"部分。

## Requirements

**头文件：** XAsyncProvider.h

**库：** xgameruntime.lib

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

## Conceptual documentation

* [设置自定义提供程序](https://docs.xbox.com/zh-CN/build/core-features/common/async/async-libraries/async-library-xasyncprovider-example-setup-custom-provider.md)
* [异步编程模型](https://docs.xbox.com/zh-CN/build/core-features/common/async/async-programming-model.md)

## See also

[XAsyncProvider Members](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/xasyncprovider_members.md)\
[XAsyncBegin](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/functions/xasyncbegin.md)\
[XAsyncSchedule](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/functions/xasyncschedule.md)\
[异步编程模型](https://docs.xbox.com/zh-CN/build/core-features/common/async/async-programming-model.md)


## Related topics

- [异步编程模型](https://docs.xbox.com/zh-CN/build/core-features/common/async/async-programming-model.md)
- [XAsyncRun](https://docs.xbox.com/zh-CN/reference/system/xasync/functions/xasyncrun.md)
- [XAsyncProvider（API 内容）](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/xasyncprovider_members.md)
- [XAsyncOp](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/enums/xasyncop.md)
- [XAsyncBegin](https://docs.xbox.com/zh-CN/reference/system/xasyncprovider/functions/xasyncbegin.md)
