XAsyncGetResult

Returns the results of an asynchronous call from an asynchronous provider.

Syntax

HRESULT XAsyncGetResult(  
         XAsyncBlock* asyncBlock,  
         const void* identity,  
         size_t bufferSize,  
         void* buffer,  
         size_t* bufferUsed  
)  

Parameters

asyncBlock   _Inout_
Type: XAsyncBlock*

A pointer to the XAsyncBlock that was passed to XAsyncBegin for the asynchronous call.

identity   _In_opt_
Type: void*

Optional. A pointer to an arbitrary token that can be used to identify the asynchronous call. If a value was specified for the identity parameter of the corresponding XAsyncBegin call, the same pointer must be specified here.

bufferSize   _In_
Type: size_t

The size, in bytes, of the result buffer specified in buffer.

buffer   _Out_writes_bytes_to_opt_(bufferSize, *bufferUsed)
Type: void*

A pointer to the result buffer.

bufferUsed   _Out_opt_
Type: size_t*

Optional. A pointer that contains the number of bytes written to the result buffer specified in buffer. This value is defined as the value of the requiredResultSize parameter, specified by the asynchronous provider when XAsyncComplete was invoked.

Return value

Type: HRESULT

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

Remarks

If the asynchronous call has a data payload, invoke this function to return the data payload. You don't need to invoke this function if the asynchronous call doesn't have a data payload. If this function is invoked for an asynchronous call that doesn't have a data payload, the function returns the error code E_NOT_SUPPORTED.

If a value was specified for the identity parameter of the XAsyncBegin function for this asynchronous call, that same value must be provided for the identity parameter of this function, as well. Otherwise, a call mismatch occurs and the function returns the error code E_INVALIDARG.

After this function is completed and results are returned in the result buffer specified in buffer, the XAsyncBlock specified in asyncBlock is completed and no longer associated with the asynchronous call.

Requirements

Header: XAsyncProvider.h

Library: xgameruntime.lib

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

See also

XAsyncProvider Members
XAsyncBegin
XAsyncComplete
Asynchronous Programming Model