Freigeben über


XAsyncComplete

Indicates that the callback function for an asynchronous provider has completed work and the results can be returned.

Syntax

void XAsyncComplete(  
         XAsyncBlock* asyncBlock,  
         HRESULT result,  
         size_t requiredBufferSize  
)  

Parameters

asyncBlock   _Inout_
Type: XAsyncBlock*

A pointer to the XAsyncBlock that was passed to XAsyncBegin.

result   _In_
Type: HRESULT

The result of the work performed by the callback function. If the work is canceled, set this to E_ABORT. If more work needs to be done, set this to E_PENDING. Otherwise, set this to the appropriate result code.

requiredBufferSize   _In_
Type: size_t

The required size, in bytes, of the data payload to be returned by the callback function. If the callback function doesn't return a data payload, set this value to zero. This parameter is ignored if the callback function returns an error.

Return value

Type: void

Remarks

Note

This function isn't safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.

This function is called when the callback function has been called to either perform or cancel asynchronous work. The function returns an appropriate result code and, if applicable, information about the data payload. The combination of XAsyncOp operation code, asynchronous work, and data payload for the callback function typically determines the values that should be provided for result and requiredBufferSize when calling this function.

If the callback function has been called with the XAsyncOp::DoWork operation code, the callback function should perform asynchronous work. If the callback function has completed all asynchronous work, set result to an appropriate error code. If more work needs to be done, set result to E_PENDING. If the function returns a data payload, set requiredBufferSize to the size, in bytes, of the buffer needed to return the data payload; otherwise, set requiredBufferSize to zero.

If the callback function has been called with the XAsyncOp::Cancel operation code, the callback function should cancel asynchronous work. Set result to E_ABORT and requiredBufferSize to zero.

Requirements

Header: XAsyncProvider.h

Library: xgameruntime.lib

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

See also

XAsyncProvider Members
XAsyncBegin
Asynchronous Programming Model