diff options
author | Diva Canto | 2009-08-14 14:04:15 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-14 14:04:15 -0700 |
commit | cd444c1e82dcf7929cc34e00a66bc16998c3d90c (patch) | |
tree | 24a2495ea19c5a2e258582fc3db8407dfc1c86be /OpenSim/Framework/ThreadTracker.cs | |
parent | Returning UUID.Zero is scene and user profile service are null in GetSession.... (diff) | |
parent | * Re-enable TestLoadIarV0_1ExistingUsers() (diff) | |
download | opensim-SC-cd444c1e82dcf7929cc34e00a66bc16998c3d90c.zip opensim-SC-cd444c1e82dcf7929cc34e00a66bc16998c3d90c.tar.gz opensim-SC-cd444c1e82dcf7929cc34e00a66bc16998c3d90c.tar.bz2 opensim-SC-cd444c1e82dcf7929cc34e00a66bc16998c3d90c.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to '')
-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 | } |