Freigeben über


XAsync library overview

The XAsync library provides methods and data that define async tasks and their callbacks. The main async primitive, XAsyncBlock, is defined in this library. It's a requirement for all async tasks.

Beyond the async block, this library provides methods to start basic async calls, get async task status, and attempt to cancel tasks.

XAsyncBlock

The XAsyncBlock is the main async primitive that contains members that are used for implementing the completion callback, providing data to the completion callback, and choosing a task queue to run in.

The async block also contains private data that's used internally by the system for runtime behavior. As a result, this block can't be shared between multiple active tasks. The system uses this data to identify the async call while the call is active.

struct XAsyncBlock
{
    /// <summary>
    /// The queue to queue the call on.
    /// </summary>
    XTaskQueueHandle queue;
    
    /// <summary>
    /// Optional context pointer to pass to the callback.
    /// </summary>
    void* context;
    
    /// <summary>
    /// Optional callback that is invoked when the call completes.
    /// </summary>
    XAsyncCompletionRoutine* callback;
    
    /// <summary>
    /// Internal use only.
    /// </summary>
    unsigned char internal[sizeof(void*) * 4];
};

See also

Setup async task
Run simple task
Run Microsoft Game Development Kit API task
XAsync system API contents