Compartir a través de


XAsyncProvider function

Represents the callback function of an asynchronous call for an asynchronous provider.

Syntax

HRESULT XAsyncProvider(  
         XAsyncOp op,  
         const XAsyncProviderData* data  
)  

Parameters

op   _In_
Type: XAsyncOp

The operation code to be performed by the callback function.

data   _Inout_
Type: XAsyncProviderData*

A pointer to the XAsyncProviderData structure used to store data for and track the asynchronous call.

Return value

Type: HRESULT

Returns S_OK if successful; otherwise, returns an error code. For a list of error codes, see Error Codes.

Remarks

The XAsyncProvider callback function is implemented by an asynchronous provider to perform asynchronous work. The callback function for an asynchronous provider is called repeatedly by the XAsync API, and what that callback function should do for each call is determined by the XAsyncOp operation code specified in op for each call. Data used by the callback function for each call, including the XAsyncBlock used to track that callback function, is specified in data.

The callback function should implement only those operation codes from XAsyncOp needed to perform asynchronous work. For example, an asynchronous provider that performs non-cancelable asynchronous I/O work which doesn't require cleanup only needs to implement XAsyncOp::GetResult in the callback function for that asynchronous provider.

For an example of an asynchronous provider that implements the DoWork, GetResult, and Cleanup operation codes from XAsyncOp and returns a data payload, see the "Async Library" section in Asynchronous Programming Model.

Requirements

Header: XAsyncProvider.h

Library: xgameruntime.lib

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

See also

XAsyncProvider Members
XAsyncOp
XAsyncProviderData
Asynchronous Programming Model