Partage via


XAsyncRun

Asynchronously runs the specified callback function.

Syntax

HRESULT XAsyncRun(  
         XAsyncBlock* asyncBlock,  
         XAsyncWork* work  
)  

Parameters

asyncBlock   _Inout_
Type: XAsyncBlock*

A pointer to the XAsyncBlock that is used to track the asynchronous call.

work   _In_
Type: XAsyncWork*

A pointer to a callback function to run asynchronously.

Return value

Type: HRESULT

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

Remarks

XAsyncRun is a helper function that asynchronously runs the callback function specified in work. You can use the XAsyncBlock specified in asyncBlock to cancel or get the status of the callback function. XAsyncRun internally uses the following XAsyncProvider functions to run and track the callback function:

For more information about implementing your own asynchronous functionality with XAsyncProvider and XAsyncBlock, 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
XAsyncProvider Members
Asynchronous Programming Model