diff options
author | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
commit | 205afe679855a4ce8149cdaa94d3f0868ce796dc (patch) | |
tree | 09bc83f73246ee3c7a779605cd0122093d2a8a19 /include/lldb/Target/ThreadCollection.h | |
parent | 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff) |
Diffstat (limited to 'include/lldb/Target/ThreadCollection.h')
-rw-r--r-- | include/lldb/Target/ThreadCollection.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/include/lldb/Target/ThreadCollection.h b/include/lldb/Target/ThreadCollection.h new file mode 100644 index 0000000000000..0c2b41cc0ca41 --- /dev/null +++ b/include/lldb/Target/ThreadCollection.h @@ -0,0 +1,70 @@ +//===-- ThreadCollection.h --------------------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_ThreadCollection_h_ +#define liblldb_ThreadCollection_h_ + +#include <vector> + +#include "lldb/lldb-private.h" +#include "lldb/Host/Mutex.h" +#include "lldb/Utility/Iterable.h" + +namespace lldb_private { + +class ThreadCollection +{ +public: + typedef std::vector<lldb::ThreadSP> collection; + typedef LockingAdaptedIterable<collection, lldb::ThreadSP, vector_adapter> ThreadIterable; + + ThreadCollection(); + + ThreadCollection(collection threads); + + virtual + ~ThreadCollection() + { + } + + uint32_t + GetSize(); + + void + AddThread (const lldb::ThreadSP &thread_sp); + + void + InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx); + + // Note that "idx" is not the same as the "thread_index". It is a zero + // based index to accessing the current threads, whereas "thread_index" + // is a unique index assigned + lldb::ThreadSP + GetThreadAtIndex (uint32_t idx); + + virtual ThreadIterable + Threads () + { + return ThreadIterable(m_threads, GetMutex()); + } + + virtual Mutex & + GetMutex() + { + return m_mutex; + } + +protected: + collection m_threads; + Mutex m_mutex; +}; + +} // namespace lldb_private + +#endif // liblldb_ThreadCollection_h_ |