XTaskQueueTerminate
Terminates a task queue by canceling all pending items and preventning new items from being queued.Syntax
Parameters
queue _In_Type: XTaskQueueHandle The queue to terminate. wait _In_
Type: bool True to wait for the termination to complete. callbackContext _In_opt_
Type: void* An optional context pointer to pass to the callback. callback _In_opt_
Type: XTaskQueueTerminatedCallback* An optional callback that will be called when the queue has terminated.
Return value
Type: HRESULT HRESULT success or error code.Remarks
This function isn’t safe to call on a time-sensitive thread. For more information, see Time-sensitive threads.
- All callbacks for both ports will be invoked with their canceled parameter set to true.
- All callbacks pending on the work port will be dispatched. Submitting new callbacks to the work port will fail with E_ABORT.
- All callbacks pending on the completion port will be dispatched. Submitting new callbacks to the completion port will fail with E_ABORT.
- XTaskQueueTerminate does not close the queue handle. After terminating you still need to call XTaskQueueCloseHandle.
- If you call XTaskQueueTerminate on a thread that is servicing queue callbacks by calling XTaskQueueDispatch, do not pass true for the wait parameter or your code may deadlock.
SubmitCallback is a helper function that is defined in the code example for the XTaskQueueSubmitCallback function.
Requirements
Header: XTaskQueue.h Library: xgameruntime.lib Supported platforms: Windows, XBOX One family consoles and XBOX Series consolesConceptual documentation
See also
XTaskQueue membersAsynchronous Programming Model
Async Task Queue design
