diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-15 13:10:21 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-15 13:10:21 -0400 |
commit | 30ce56e7219b3d2ed16acb322cecec781c3776c5 (patch) | |
tree | 3ab732fc9c8775a3fab0a705b4496ea21c1ab128 /OpenSim/Framework/ThreadTracker.cs | |
parent | * part one of adding physics combining (diff) | |
parent | * whoops, missing a / (diff) | |
download | opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.zip opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.gz opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.bz2 opensim-SC_OLD-30ce56e7219b3d2ed16acb322cecec781c3776c5.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Framework/ThreadTracker.cs')
-rw-r--r-- | OpenSim/Framework/ThreadTracker.cs | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/OpenSim/Framework/ThreadTracker.cs b/OpenSim/Framework/ThreadTracker.cs index d8bd2c0..fa6f0b8 100644 --- a/OpenSim/Framework/ThreadTracker.cs +++ b/OpenSim/Framework/ThreadTracker.cs | |||
@@ -77,12 +77,15 @@ namespace OpenSim.Framework | |||
77 | public static void Add(Thread thread) | 77 | public static void Add(Thread thread) |
78 | { | 78 | { |
79 | #if DEBUG | 79 | #if DEBUG |
80 | lock (m_Threads) | 80 | if (thread != null) |
81 | { | 81 | { |
82 | ThreadTrackerItem tti = new ThreadTrackerItem(); | 82 | lock (m_Threads) |
83 | tti.Thread = thread; | 83 | { |
84 | tti.LastSeenActive = DateTime.Now.Ticks; | 84 | ThreadTrackerItem tti = new ThreadTrackerItem(); |
85 | m_Threads.Add(tti); | 85 | tti.Thread = thread; |
86 | tti.LastSeenActive = DateTime.Now.Ticks; | ||
87 | m_Threads.Add(tti); | ||
88 | } | ||
86 | } | 89 | } |
87 | #endif | 90 | #endif |
88 | } | 91 | } |
@@ -107,16 +110,25 @@ namespace OpenSim.Framework | |||
107 | { | 110 | { |
108 | foreach (ThreadTrackerItem tti in new ArrayList(m_Threads)) | 111 | foreach (ThreadTrackerItem tti in new ArrayList(m_Threads)) |
109 | { | 112 | { |
110 | if (tti.Thread.IsAlive) | 113 | try |
111 | { | 114 | { |
112 | // Its active | 115 | |
113 | tti.LastSeenActive = DateTime.Now.Ticks; | 116 | |
117 | if (tti.Thread.IsAlive) | ||
118 | { | ||
119 | // Its active | ||
120 | tti.LastSeenActive = DateTime.Now.Ticks; | ||
121 | } | ||
122 | else | ||
123 | { | ||
124 | // Its not active -- if its expired then remove it | ||
125 | if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) | ||
126 | m_Threads.Remove(tti); | ||
127 | } | ||
114 | } | 128 | } |
115 | else | 129 | catch (NullReferenceException) |
116 | { | 130 | { |
117 | // Its not active -- if its expired then remove it | 131 | m_Threads.Remove(tti); |
118 | if (tti.LastSeenActive + ThreadTimeout < DateTime.Now.Ticks) | ||
119 | m_Threads.Remove(tti); | ||
120 | } | 132 | } |
121 | } | 133 | } |
122 | } | 134 | } |