32 QueueImpl(
const lldb::QueueSP &queue_sp) { m_queue_wp = queue_sp; }
46 bool IsValid() {
return m_queue_wp.lock() !=
nullptr; }
50 m_thread_list_fetched =
false;
52 m_pending_items_fetched =
false;
53 m_pending_items.clear();
58 m_queue_wp = queue_sp;
63 lldb::QueueSP queue_sp = m_queue_wp.lock();
65 result = queue_sp->GetID();
72 lldb::QueueSP queue_sp = m_queue_wp.lock();
74 result = queue_sp->GetIndexID();
80 const char *name =
nullptr;
81 lldb::QueueSP queue_sp = m_queue_wp.lock();
83 name = queue_sp->GetName();
89 if (!m_thread_list_fetched) {
90 lldb::QueueSP queue_sp = m_queue_wp.lock();
93 if (stop_locker.
TryLock(&queue_sp->GetProcess()->GetRunLock())) {
94 const std::vector<ThreadSP> thread_list(queue_sp->GetThreads());
95 m_thread_list_fetched =
true;
96 const uint32_t num_threads = thread_list.size();
97 for (
uint32_t idx = 0; idx < num_threads; ++idx) {
98 ThreadSP thread_sp = thread_list[idx];
99 if (thread_sp && thread_sp->IsValid()) {
100 m_threads.push_back(thread_sp);
109 if (!m_pending_items_fetched) {
110 QueueSP queue_sp = m_queue_wp.lock();
113 if (stop_locker.
TryLock(&queue_sp->GetProcess()->GetRunLock())) {
114 const std::vector<QueueItemSP> queue_items(
115 queue_sp->GetPendingItems());
116 m_pending_items_fetched =
true;
117 const uint32_t num_pending_items = queue_items.size();
118 for (
uint32_t idx = 0; idx < num_pending_items; ++idx) {
119 QueueItemSP item = queue_items[idx];
120 if (item && item->IsValid()) {
121 m_pending_items.push_back(item);
133 if (m_thread_list_fetched) {
134 result = m_threads.size();
143 QueueSP queue_sp = m_queue_wp.lock();
144 if (queue_sp && idx < m_threads.size()) {
145 ProcessSP process_sp = queue_sp->
GetProcess();
147 ThreadSP thread_sp = m_threads[idx].lock();
159 QueueSP queue_sp = m_queue_wp.lock();
160 if (!m_pending_items_fetched && queue_sp) {
161 result = queue_sp->GetNumPendingWorkItems();
163 result = m_pending_items.size();
171 if (m_pending_items_fetched && idx < m_pending_items.size()) {
179 QueueSP queue_sp = m_queue_wp.lock();
181 result = queue_sp->GetNumRunningWorkItems();
187 QueueSP queue_sp = m_queue_wp.lock();
189 result.
SetSP(queue_sp->GetProcess());
196 QueueSP queue_sp = m_queue_wp.lock();
198 kind = queue_sp->GetKind();
205 std::vector<lldb::ThreadWP>
207 bool m_thread_list_fetched =
210 bool m_pending_items_fetched =
242 return this->
operator bool();
244 SBQueue::operator bool()
const {
247 return m_opaque_sp->IsValid();