diff options
author | UbitUmarov | 2017-05-23 05:34:25 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-23 05:34:25 +0100 |
commit | 8e777d50a63038a73cb2e56d24698aa9bb416e57 (patch) | |
tree | 7bcee195b5ff6f9dcd6205452e7237678b9c399a /OpenSim/Region/ScriptEngine/Shared/Api/Implementation | |
parent | dont fail saving a OAR because of a broken material (diff) | |
download | opensim-SC-8e777d50a63038a73cb2e56d24698aa9bb416e57.zip opensim-SC-8e777d50a63038a73cb2e56d24698aa9bb416e57.tar.gz opensim-SC-8e777d50a63038a73cb2e56d24698aa9bb416e57.tar.bz2 opensim-SC-8e777d50a63038a73cb2e56d24698aa9bb416e57.tar.xz |
only remove AsyncCommandManager thread when last instance is deleted
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-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 | } |