You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
Newtonsoft.Json
api-doc-tools
api-snapshot
aspnetwebstack
bdwgc
binary-reference-assemblies
bockbuild
boringssl
cecil
cecil-legacy
corefx
corert
helix-binaries
ikdasm
ikvm
illinker-test-assets
linker
llvm-project
clang
clang-tools-extra
compiler-rt
eng
libcxx
libcxxabi
libunwind
lld
lldb
cmake
docs
examples
include
lit
lldb.xcodeproj
lldb.xcworkspace
packages
resources
scripts
source
API
Breakpoint
Commands
Core
DataFormatters
Expression
Host
Initialization
Interpreter
Plugins
Symbol
Target
ABI.cpp
CMakeLists.txt
CPPLanguageRuntime.cpp
ExecutionContext.cpp
FileAction.cpp
InstrumentationRuntime.cpp
InstrumentationRuntimeStopInfo.cpp
JITLoader.cpp
JITLoaderList.cpp
Language.cpp
LanguageRuntime.cpp
Memory.cpp
MemoryHistory.cpp
ModuleCache.cpp
ObjCLanguageRuntime.cpp
OperatingSystem.cpp
PathMappingList.cpp
Platform.cpp
Process.cpp.REMOVED.git-id
ProcessInfo.cpp
ProcessLaunchInfo.cpp
Queue.cpp
QueueItem.cpp
QueueList.cpp
RegisterContext.cpp
RegisterNumber.cpp
SectionLoadHistory.cpp
SectionLoadList.cpp
StackFrame.cpp
StackFrameList.cpp
StackID.cpp
StopInfo.cpp
StructuredDataPlugin.cpp
SystemRuntime.cpp
Target.cpp.REMOVED.git-id
TargetList.cpp
Thread.cpp
ThreadCollection.cpp
ThreadList.cpp
ThreadPlan.cpp
ThreadPlanBase.cpp
ThreadPlanCallFunction.cpp
ThreadPlanCallFunctionUsingABI.cpp
ThreadPlanCallOnFunctionExit.cpp
ThreadPlanCallUserExpression.cpp
ThreadPlanPython.cpp
ThreadPlanRunToAddress.cpp
ThreadPlanShouldStopHere.cpp
ThreadPlanStepInRange.cpp
ThreadPlanStepInstruction.cpp
ThreadPlanStepOut.cpp
ThreadPlanStepOverBreakpoint.cpp
ThreadPlanStepOverRange.cpp
ThreadPlanStepRange.cpp
ThreadPlanStepThrough.cpp
ThreadPlanStepUntil.cpp
ThreadPlanTracer.cpp
ThreadSpec.cpp
UnixSignals.cpp
UnwindAssembly.cpp
Utility
CMakeLists.txt
lldb.cpp
third_party
tools
unittests
utils
www
.arcconfig
.clang-format
.gitignore
CMakeLists.txt
CODE_OWNERS.txt
INSTALL.txt
LICENSE.TXT
use_lldb_suite_root.py
llvm
nuget
openmp
polly
Directory.Build.props
Directory.Build.targets
NuGet.config
azure-pipelines.yml
build.cmd
build.sh
dir.common.props
global.json
llvm.proj
mxe-Win64.cmake.in
nuget-buildtasks
nunit-lite
roslyn-binaries
rx
xunit-binaries
how-to-bump-roslyn-binaries.md
ikvm-native
llvm
m4
man
mcs
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
67 lines
2.2 KiB
C++
67 lines
2.2 KiB
C++
//===-- 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 <mutex>
|
|
|
|
#include "lldb/Target/Thread.h"
|
|
#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) {
|
|
std::lock_guard<std::recursive_mutex> guard(GetMutex());
|
|
m_threads.push_back(thread_sp);
|
|
}
|
|
|
|
void ThreadCollection::AddThreadSortedByIndexID(const ThreadSP &thread_sp) {
|
|
std::lock_guard<std::recursive_mutex> guard(GetMutex());
|
|
// Make sure we always keep the threads sorted by thread index ID
|
|
const uint32_t thread_index_id = thread_sp->GetIndexID();
|
|
if (m_threads.empty() || m_threads.back()->GetIndexID() < thread_index_id)
|
|
m_threads.push_back(thread_sp);
|
|
else {
|
|
m_threads.insert(
|
|
std::upper_bound(m_threads.begin(), m_threads.end(), thread_sp,
|
|
[](const ThreadSP &lhs, const ThreadSP &rhs) -> bool {
|
|
return lhs->GetIndexID() < rhs->GetIndexID();
|
|
}),
|
|
thread_sp);
|
|
}
|
|
}
|
|
|
|
void ThreadCollection::InsertThread(const lldb::ThreadSP &thread_sp,
|
|
uint32_t idx) {
|
|
std::lock_guard<std::recursive_mutex> guard(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() {
|
|
std::lock_guard<std::recursive_mutex> guard(GetMutex());
|
|
return m_threads.size();
|
|
}
|
|
|
|
ThreadSP ThreadCollection::GetThreadAtIndex(uint32_t idx) {
|
|
std::lock_guard<std::recursive_mutex> guard(GetMutex());
|
|
ThreadSP thread_sp;
|
|
if (idx < m_threads.size())
|
|
thread_sp = m_threads[idx];
|
|
return thread_sp;
|
|
}
|