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

# XAsync 程式庫概觀

> XAsync 程式庫概觀

[XAsync](/zh-TW/reference/system/xasync/xasync_members) 程式庫提供定義非同步工作及其回呼的方法和資料。主要的非同步基本型別 [XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock) 即定義於此程式庫中。它是
所有非同步工作的必要項目。

除了非同步區塊之外，此程式庫還提供用於[啟動基本非同步呼叫](/zh-TW/reference/system/xasync/functions/xasyncrun)、[取得非同步工作狀態](/zh-TW/reference/system/xasync/functions/xasyncgetstatus)以及[嘗試取消工作](/zh-TW/reference/system/xasync/functions/xasynccancel)的方法。

<a id="xasyncblock" />

## XAsyncBlock

[XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock) 是主要的非同步基本型別，其包含的成員可用於實作完成回呼、提供資料給完成回呼，以及選擇要在其中執行的工作佇列。

非同步區塊也包含系統在內部用於執行階段行為的私用資料。因此，此區塊無法在多個作用中的工作之間共用。系統會在呼叫作用中時使用此資料來識別非同步呼叫。

```c++ theme={null}
struct XAsyncBlock
{
    /// <summary>
    /// The queue to queue the call on.
    /// </summary>
    XTaskQueueHandle queue;
    
    /// <summary>
    /// Optional context pointer to pass to the callback.
    /// </summary>
    void* context;
    
    /// <summary>
    /// Optional callback that is invoked when the call completes.
    /// </summary>
    XAsyncCompletionRoutine* callback;
    
    /// <summary>
    /// Internal use only.
    /// </summary>
    unsigned char internal[sizeof(void*) * 4];
};
```

## 參考 API 文件

* [XAsync (API 內容)](/zh-TW/reference/system/xasync/xasync_members)
  * 函式
    * [xasyncrun](/zh-TW/reference/system/xasync/functions/xasyncrun)
    * [xasyncgetstatus](/zh-TW/reference/system/xasync/functions/xasyncgetstatus)
    * [xasynccancel](/zh-TW/reference/system/xasync/functions/xasynccancel)
  * 結構
    * [XAsyncBlock](/zh-TW/reference/system/xasync/structs/xasyncblock)

## 另請參閱

[設定非同步工作](/zh-TW/build/core-features/common/async/async-libraries/async-library-xasync-example-setup-async-task)
[執行簡單工作](/zh-TW/build/core-features/common/async/async-libraries/async-library-xasync-example-run-simple-task)
[執行 Microsoft Game Development Kit API 工作](/zh-TW/build/core-features/common/async/async-libraries/async-library-xasync-example-run-gdk-task)
[XAsync 系統 API 內容](/zh-TW/reference/system/xasync/xasync_members)


## Related topics

- [PlayFab Multiplayer C++ SDK 版本資訊](/zh-TW/services/playfab/multiplayer/lobby/lobby-matchmaking-sdks/lobby-and-matchmaking-release-notes.md)
- [PlayFab Party 版本資訊](/zh-TW/services/playfab/multiplayer/networking/release-notes.md)
- [開發新的 GDK 遊戲](/zh-TW/home/build-first-title/developing-new-titles.md)
- [XBOX 合作夥伴加入流程:取得存取權限與發行](/zh-TW/home/onboarding.md)
- [設定並安裝 GDK](/zh-TW/home/setup-install/get-started.md)
