共用方式為


XAsyncCompletionRoutine

Represents the completion callback for an asynchronous call.

Syntax

void XAsyncCompletionRoutine(  
         XAsyncBlock* asyncBlock  
)  

Parameters

asyncBlock   _Inout_
Type: XAsyncBlock*

A pointer to the XAsyncBlock for the completion callback.

Return value

Type: void

Remarks

You can optionally specify an XAsyncCompletionRoutine pointer to provide a completion callback for an asynchronous call. A completion callback is a callback function that executes after the completion of an asynchronous call. You can specify an XAsyncCompletionRoutine pointer in the callback member of an XAsyncBlock structure for an asynchronous call.

Typically, a completion callback processes the results of an asynchronous call on another thread. The completion callback represents a callback function that is invoked when the asynchronous call completes. The callback function takes an XAsyncBlock pointer, which is subsequently used to obtain the results of the callback function.

If you specify a completion callback, you can periodically check if the completion callback is completed by using the XAsyncGetStatus function, and then use XAsyncGetResult and XAsyncGetResultSize as needed to get the results from the completed task.

A completion callback is invoked even if XAsyncCancel is invoked to cancel the asynchronous call.

Use XAsyncGetStatus or the completion callback's Get\*Result method to obtain the results of the asynchronous call. If the asynchronous call was canceled these methods return E_ABORT. For more information about the implementation pattern of an asynchronous provider, including the Get\*Result method, see Asynchronous Programming Model.

Requirements

Header: XAsync.h

Library: xgameruntime.lib

Supported platforms: Windows, Xbox One family consoles and Xbox Series consoles

See also

XAsync Members
XAsyncGetStatus
Asynchronous Programming Model