File indexing completed on 2026-05-10 08:42:55
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLDB_TARGET_THREADCOLLECTION_H
0010 #define LLDB_TARGET_THREADCOLLECTION_H
0011
0012 #include <mutex>
0013 #include <vector>
0014
0015 #include "lldb/Utility/Iterable.h"
0016 #include "lldb/lldb-private.h"
0017
0018 namespace lldb_private {
0019
0020 class ThreadCollection {
0021 public:
0022 typedef std::vector<lldb::ThreadSP> collection;
0023 typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter,
0024 std::recursive_mutex>
0025 ThreadIterable;
0026
0027 ThreadCollection();
0028
0029 ThreadCollection(collection threads);
0030
0031 virtual ~ThreadCollection() = default;
0032
0033 uint32_t GetSize();
0034
0035 void AddThread(const lldb::ThreadSP &thread_sp);
0036
0037 void AddThreadSortedByIndexID(const lldb::ThreadSP &thread_sp);
0038
0039 void InsertThread(const lldb::ThreadSP &thread_sp, uint32_t idx);
0040
0041
0042
0043
0044 lldb::ThreadSP GetThreadAtIndex(uint32_t idx);
0045
0046 virtual ThreadIterable Threads() {
0047 return ThreadIterable(m_threads, GetMutex());
0048 }
0049
0050 virtual std::recursive_mutex &GetMutex() const { return m_mutex; }
0051
0052 protected:
0053 collection m_threads;
0054 mutable std::recursive_mutex m_mutex;
0055 };
0056
0057 }
0058
0059 #endif