MCPcopy Create free account
hub / github.com/XpuOS/xsched / Del

Method Del

preempt/src/xqueue/xqueue.cpp:51–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51XResult 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
73XResult XQueueManager::Exists(XQueueHandle xq_h)
74{

Callers

nothing calls this directly

Calls 5

GetHwQueueMethod · 0.80
SetXQueueMethod · 0.80
WaitAllMethod · 0.80
unlockMethod · 0.45
ResumeMethod · 0.45

Tested by

no test coverage detected