หมายเหตุ
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลอง ลงชื่อเข้าใช้หรือเปลี่ยนไดเรกทอรีได้
การเข้าถึงหน้านี้ต้องได้รับการอนุญาต คุณสามารถลองเปลี่ยนไดเรกทอรีได้
This topic provides an example of how to dispatch a task queue. Dispatching a task queue is necessary for each manual port. How and when the ports are dispatched determines the threaded and concurrent behavior of the enqueued callbacks.
std::thread dispatherThread = std::thread(
[taskQueue]()
{
while (true)
{
bool processed = XTaskQueueDispatch(taskQueue,
XTaskQueuePort::Completion, INFINITE);
if (!processed)
{
// The task queue has been terminated, so return.
break;
}
}
});
This example shows an extra thread being spawned to constantly dispatch the completion port of the passed-in task queue until it's terminated.