diff options
author | Justin Clark-Casey (justincc) | 2014-12-10 00:04:10 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-12-10 00:04:10 +0000 |
commit | 227d2e2b616ad52331b387f2dbf3392583f194f6 (patch) | |
tree | 19aea7ced0383e047c989040ad9e45b1378d1142 /OpenSim/Region/ScriptEngine | |
parent | In XEngine, enqueue a script rez to the compile queue after setting m_Compile... (diff) | |
download | opensim-SC-227d2e2b616ad52331b387f2dbf3392583f194f6.zip opensim-SC-227d2e2b616ad52331b387f2dbf3392583f194f6.tar.gz opensim-SC-227d2e2b616ad52331b387f2dbf3392583f194f6.tar.bz2 opensim-SC-227d2e2b616ad52331b387f2dbf3392583f194f6.tar.xz |
Avoid a possible race condition where the XEngine script compile thread could complete but see OnRezScript() insert a new job and complete before it set m_CurrentCompile = null
If the above happened, it would mean the new script would not compile until some script was added for compilation.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 7ff82e6..ccd5d99 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1101,7 +1101,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1101 | // due to a race condition | 1101 | // due to a race condition |
1102 | // | 1102 | // |
1103 | lock (m_CompileQueue) | 1103 | lock (m_CompileQueue) |
1104 | { | ||
1104 | m_CurrentCompile = null; | 1105 | m_CurrentCompile = null; |
1106 | |||
1107 | // This is to avoid a situation where the m_CompileQueue while loop above could complete but | ||
1108 | // OnRezScript() place a new script on the queue and check m_CurrentCompile = null before we hit | ||
1109 | // this section. | ||
1110 | if (m_CompileQueue.Count > 0) | ||
1111 | m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null); | ||
1112 | } | ||
1105 | } | 1113 | } |
1106 | 1114 | ||
1107 | return null; | 1115 | return null; |