LLDB mainline
QueueList.cpp
Go to the documentation of this file.
1//===-- QueueList.cpp -----------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "lldb/Target/Queue.h"
10#include "lldb/Target/Process.h"
12
13using namespace lldb;
14using namespace lldb_private;
15
17 : m_process(process), m_stop_id(0), m_queues(), m_mutex() {}
18
20
22 std::lock_guard<std::mutex> guard(m_mutex);
23 return m_queues.size();
24}
25
27 std::lock_guard<std::mutex> guard(m_mutex);
28 if (idx < m_queues.size()) {
29 return m_queues[idx];
30 } else {
31 return QueueSP();
32 }
33}
34
36 std::lock_guard<std::mutex> guard(m_mutex);
37 m_queues.clear();
38}
39
41 std::lock_guard<std::mutex> guard(m_mutex);
42 if (queue_sp.get()) {
43 m_queues.push_back(queue_sp);
44 }
45}
46
48 QueueSP ret;
49 for (QueueSP queue_sp : Queues()) {
50 if (queue_sp->GetID() == qid) {
51 ret = queue_sp;
52 break;
53 }
54 }
55 return ret;
56}
57
59 QueueSP ret;
60 for (QueueSP queue_sp : Queues()) {
61 if (queue_sp->GetIndexID() == index_id) {
62 ret = queue_sp;
63 break;
64 }
65 }
66 return ret;
67}
68
69std::mutex &QueueList::GetMutex() { return m_mutex; }
A plug-in interface definition class for debugging a process.
Definition: Process.h:341
QueueIterable Queues()
Iterate over the list of queues.
Definition: QueueList.h:60
uint32_t GetSize()
Get the number of libdispatch queues that are available.
Definition: QueueList.cpp:21
lldb::QueueSP GetQueueAtIndex(uint32_t idx)
Get the Queue at a given index number.
Definition: QueueList.cpp:26
lldb::QueueSP FindQueueByID(lldb::queue_id_t qid)
Find a queue in the QueueList by QueueID.
Definition: QueueList.cpp:47
void AddQueue(lldb::QueueSP queue)
Add a Queue to the QueueList.
Definition: QueueList.cpp:40
lldb::QueueSP FindQueueByIndexID(uint32_t index_id)
Find a queue in the QueueList by IndexID.
Definition: QueueList.cpp:58
std::mutex & GetMutex()
Definition: QueueList.cpp:69
void Clear()
Clear out the list of queues from the QueueList.
Definition: QueueList.cpp:35
collection m_queues
The queues for this process.
Definition: QueueList.h:101
A class that represents a running process on the host machine.
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::Queue > QueueSP
Definition: lldb-forward.h:396
uint64_t queue_id_t
Definition: lldb-types.h:90