summaryrefslogtreecommitdiffstats
path: root/source/Target/ThreadCollection.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
committeremaste <emaste@FreeBSD.org>2015-02-06 21:38:51 +0000
commit0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (patch)
tree09bc83f73246ee3c7a779605cd0122093d2a8a19 /source/Target/ThreadCollection.cpp
parent01ee1789d6aa7294e5966a97f8d29387f6f81699 (diff)
downloadFreeBSD-src-0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531.zip
FreeBSD-src-0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531.tar.gz
Import LLDB as of upstream SVN r225923 (git 2b588ecd)
This corresponds with the branchpoint for the 3.6 release. A number of files not required for the FreeBSD build have been removed. Sponsored by: DARPA, AFRL
Diffstat (limited to 'source/Target/ThreadCollection.cpp')
-rw-r--r--source/Target/ThreadCollection.cpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/source/Target/ThreadCollection.cpp b/source/Target/ThreadCollection.cpp
new file mode 100644
index 0000000..dc1e38e
--- /dev/null
+++ b/source/Target/ThreadCollection.cpp
@@ -0,0 +1,62 @@
+//===-- ThreadCollection.cpp ------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+#include <stdlib.h>
+
+#include <algorithm>
+
+#include "lldb/Target/ThreadCollection.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+ThreadCollection::ThreadCollection() :
+ m_threads(),
+ m_mutex()
+{
+}
+
+ThreadCollection::ThreadCollection(collection threads) :
+ m_threads(threads),
+ m_mutex()
+{
+}
+
+void
+ThreadCollection::AddThread (const ThreadSP &thread_sp)
+{
+ Mutex::Locker locker(GetMutex());
+ m_threads.push_back (thread_sp);
+}
+
+void
+ThreadCollection::InsertThread (const lldb::ThreadSP &thread_sp, uint32_t idx)
+{
+ Mutex::Locker locker(GetMutex());
+ if (idx < m_threads.size())
+ m_threads.insert(m_threads.begin() + idx, thread_sp);
+ else
+ m_threads.push_back (thread_sp);
+}
+
+uint32_t
+ThreadCollection::GetSize ()
+{
+ Mutex::Locker locker(GetMutex());
+ return m_threads.size();
+}
+
+ThreadSP
+ThreadCollection::GetThreadAtIndex (uint32_t idx)
+{
+ Mutex::Locker locker(GetMutex());
+ ThreadSP thread_sp;
+ if (idx < m_threads.size())
+ thread_sp = m_threads[idx];
+ return thread_sp;
+}
OpenPOWER on IntegriCloud