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.
mb-throttle-test
Justin Clark-Casey (justincc) 2014-12-10 00:04:10 +00:00
parent 76722d8324
commit 227d2e2b61
1 changed files with 8 additions and 0 deletions

View File

@ -1101,7 +1101,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// due to a race condition
//
lock (m_CompileQueue)
{
m_CurrentCompile = null;
// This is to avoid a situation where the m_CompileQueue while loop above could complete but
// OnRezScript() place a new script on the queue and check m_CurrentCompile = null before we hit
// this section.
if (m_CompileQueue.Count > 0)
m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null);
}
}
return null;