/
n-dimens
/
pascalabcnet
Обзор
Документация
Войти
/
n-dimens
/
pascalabcnet
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Debugger.Core/Src/Threads/Process-Threads.cs
62 строки
1 KB
Бондарев Иван
initial commit
14 май 2015, 22:35
14 май 2015, 22:35
e6e67c1
Код
Авторство
О чём код?
// <file> // <copyright see="prj:///doc/copyright.txt"/> // <license see="prj:///doc/license.txt"/> // <owner name="David Srbecký" email="dsrbecky@gmail.com"/> // <version>$Revision: 1919 $</version> // </file> using System; using System.Collections.Generic; using Debugger.Wrappers.CorDebug; namespace Debugger { public partial class Process { List<Thread> threadCollection = new List<Thread>(); public event EventHandler<ThreadEventArgs> ThreadStarted; protected virtual void OnThreadStarted(Thread thread) { if (ThreadStarted != null) { ThreadStarted(this, new ThreadEventArgs(thread)); } } public IList<Thread> Threads { get { List<Thread> threads = new List<Thread>(); foreach(Thread thread in threadCollection) { if (!thread.HasExpired) { threads.Add(thread); } } return threads.AsReadOnly(); } } internal Thread GetThread(ICorDebugThread corThread) { foreach(Thread thread in threadCollection) { if (thread.CorThread == corThread) { return thread; } } throw new DebuggerException("Thread is not in collection"); } internal void AddThread(ICorDebugThread corThread) { Thread thread = new Thread(this, corThread); threadCollection.Add(thread); OnThreadStarted(thread); thread.NativeThreadExited += delegate { threadCollection.Remove(thread); }; } } }