| 49 | } |
| 50 | |
| 51 | XResult XQueueManager::Del(XQueueHandle xq_h) |
| 52 | { |
| 53 | std::unique_lock<std::mutex> lock(mtx_); |
| 54 | auto it = xqs_.find(xq_h); |
| 55 | if (it == xqs_.end()) { |
| 56 | XWARN("XQueue with handle 0x" FMT_64X " does not exist", xq_h); |
| 57 | return kXSchedErrorNotFound; |
| 58 | } |
| 59 | |
| 60 | auto xq_shptr = it->second; |
| 61 | auto hwq_shptr = xq_shptr->GetHwQueue(); |
| 62 | if (hwq_shptr != nullptr) hwq_shptr->SetXQueue(nullptr); // Break circular reference. |
| 63 | xqs_.erase(it); |
| 64 | lock.unlock(); // avoid xq_shptr->WaitAll(); with the lock held. |
| 65 | |
| 66 | // Wait for all commands to finish to prevent the launch worker from launching |
| 67 | // commands on the HwQueue after the XQueue is deleted from the XQueueManager. |
| 68 | xq_shptr->Resume(kQueueResumeFlagNone); |
| 69 | xq_shptr->WaitAll(); |
| 70 | return kXSchedSuccess; |
| 71 | } |
| 72 | |
| 73 | XResult XQueueManager::Exists(XQueueHandle xq_h) |
| 74 | { |
nothing calls this directly
no test coverage detected