diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 2a31efd..5e7a724 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
51 | 51 | ||
52 | private static Thread cmdHandlerThread; | 52 | private static Thread cmdHandlerThread; |
53 | private static int cmdHandlerThreadCycleSleepms; | 53 | private static int cmdHandlerThreadCycleSleepms; |
54 | 54 | private static int numInstances; | |
55 | /// <summary> | 55 | /// <summary> |
56 | /// Lock for reading/writing static components of AsyncCommandManager. | 56 | /// Lock for reading/writing static components of AsyncCommandManager. |
57 | /// </summary> | 57 | /// </summary> |
@@ -172,6 +172,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
172 | if (!m_XmlRequest.ContainsKey(m_ScriptEngine)) | 172 | if (!m_XmlRequest.ContainsKey(m_ScriptEngine)) |
173 | m_XmlRequest[m_ScriptEngine] = new XmlRequest(this); | 173 | m_XmlRequest[m_ScriptEngine] = new XmlRequest(this); |
174 | 174 | ||
175 | numInstances++; | ||
175 | StartThread(); | 176 | StartThread(); |
176 | } | 177 | } |
177 | } | 178 | } |
@@ -199,12 +200,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
199 | // Shut down thread | 200 | // Shut down thread |
200 | try | 201 | try |
201 | { | 202 | { |
202 | if (cmdHandlerThread != null) | 203 | lock (staticLock) |
203 | { | 204 | { |
204 | if (cmdHandlerThread.IsAlive == true) | 205 | numInstances--; |
206 | if(numInstances > 0) | ||
207 | return; | ||
208 | if (cmdHandlerThread != null) | ||
205 | { | 209 | { |
206 | cmdHandlerThread.Abort(); | 210 | if (cmdHandlerThread.IsAlive == true) |
211 | { | ||
212 | cmdHandlerThread.Abort(); | ||
207 | //cmdHandlerThread.Join(); | 213 | //cmdHandlerThread.Join(); |
214 | } | ||
208 | } | 215 | } |
209 | } | 216 | } |
210 | } | 217 | } |