1 //===-- QueueList.cpp -----------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Target/Queue.h"
10 #include "lldb/Target/Process.h"
11 #include "lldb/Target/QueueList.h"
14 using namespace lldb_private
;
16 QueueList::QueueList(Process
*process
)
17 : m_process(process
), m_stop_id(0), m_queues(), m_mutex() {}
19 QueueList::~QueueList() { Clear(); }
21 uint32_t QueueList::GetSize() {
22 std::lock_guard
<std::mutex
> guard(m_mutex
);
23 return m_queues
.size();
26 lldb::QueueSP
QueueList::GetQueueAtIndex(uint32_t idx
) {
27 std::lock_guard
<std::mutex
> guard(m_mutex
);
28 if (idx
< m_queues
.size()) {
35 void QueueList::Clear() {
36 std::lock_guard
<std::mutex
> guard(m_mutex
);
40 void QueueList::AddQueue(QueueSP queue_sp
) {
41 std::lock_guard
<std::mutex
> guard(m_mutex
);
43 m_queues
.push_back(queue_sp
);
47 lldb::QueueSP
QueueList::FindQueueByID(lldb::queue_id_t qid
) {
49 for (QueueSP queue_sp
: Queues()) {
50 if (queue_sp
->GetID() == qid
) {
58 lldb::QueueSP
QueueList::FindQueueByIndexID(uint32_t index_id
) {
60 for (QueueSP queue_sp
: Queues()) {
61 if (queue_sp
->GetIndexID() == index_id
) {
69 std::mutex
&QueueList::GetMutex() { return m_mutex
; }