2 using System.Collections.Generic;
4 using System.Threading;
5 using DirectOutput.General.Generic;
7 namespace DirectOutput.General
16 private object ListUpdateLocker=
new object();
25 public void HeartBeat(
object HostObject=null)
29 this[Thread.CurrentThread].HeartBeat();
31 catch (ArgumentException AE)
33 if (AE.ParamName ==
"Thread")
36 if (HostObject != null)
40 TI.
HostName = ((INamedItem)HostObject).Name;
44 TI.
HostName = HostObject.GetType().Name;
47 lock (ListUpdateLocker)
62 public void HeartBeat(
string HostObjectName)
66 this[Thread.CurrentThread].HeartBeat();
68 catch (ArgumentException AE)
70 if (AE.ParamName ==
"Thread")
73 if(!HostObjectName.IsNullOrWhiteSpace()) {
77 lock (ListUpdateLocker)
91 HeartBeat(HostObject);
92 this[Thread.CurrentThread].RecordException(Exception);
101 public void ThreadTerminates()
103 if (this.Contains(Thread.CurrentThread))
105 lock (ListUpdateLocker)
107 this.Remove(
this[Thread.CurrentThread]);
124 if (Contains(Thread))
126 return this.First(TI => TI.Thread == Thread);
128 throw new ArgumentException(
"The ThreadInfoList does not contain a ThreadInfo object for thread {0}.".Build(Thread.Name),
"Thread");
140 public bool Contains(Thread Thread)
142 return this.Any(TI=>TI.Thread==Thread);