Compartilhar via


XTaskQueueCallback

A callback that is invoked by the task queue.

Syntax

void XTaskQueueCallback(  
         void* context,  
         bool canceled  
)  

Parameters

context   _In_opt_
Type: void*

Optional. A context pointer passed when calling XTaskQueueSubmitCallback.

canceled   _In_
Type: bool

If true, the callback is being canceled because the task queue is terminating.

Return value

Type: void

Remarks

The XTaskQueueCallback callback is implemented to perform work on a task queue. Callbacks can be submitted to either the work port or completion port of a task queue by invoking XTaskQueueSubmitCallback or XTaskQueueSubmitDelayedCallback. The work port and completion port of a task queue can have independent dispatch modes, and XTaskQueueCallback callbacks can be submitted to either port. Typically, a callback submitted to a work port in turn submits a corresponding callback to the completion port upon completing its work.

The purpose of the canceled parameter is to ensure that any resources allocated by a callback can be properly released if a callback is canceled. If an XTaskQueueCallback callback is called and canceled is set to true, then the task queue for that callback has been terminated by calling XTaskQueueTerminate and the callback has been canceled. The callback should release any allocated resources, including the memory allocated in context, and perform no other work.

For an example, see Submitting callbacks.

Requirements

Header: XTaskQueue.h

Library: xgameruntime.lib

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

See also

XTaskQueue members
Asynchronous Programming Model
Async Task Queue Design