Maintenance thread in charge of loading/unloading of scripts. 1 thread less per region.
Total so far: 2 threads less per region Note: Currently causes delay in load/unload of scriptsafrisby-rexmerge
parent
9f7366210a
commit
3bb0fe098f
|
@ -168,6 +168,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
|
Last_maxFunctionExecutionTimens = DateTime.Now.Ticks; // Reset time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LOAD / UNLOAD SCRIPTS
|
||||||
|
if (m_ScriptEngine.m_ScriptManager != null)
|
||||||
|
m_ScriptEngine.m_ScriptManager.DoScriptLoadUnload();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,14 +129,14 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
if (PrivateThread)
|
if (PrivateThread)
|
||||||
{
|
{
|
||||||
// Assign one thread per region
|
// Assign one thread per region
|
||||||
scriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
//scriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Shared thread - make sure one exist, then assign it to the private
|
// Shared thread - make sure one exist, then assign it to the private
|
||||||
if (staticScriptLoadUnloadThread == null)
|
if (staticScriptLoadUnloadThread == null)
|
||||||
{
|
{
|
||||||
staticScriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
//staticScriptLoadUnloadThread = StartScriptLoadUnloadThread();
|
||||||
}
|
}
|
||||||
scriptLoadUnloadThread = staticScriptLoadUnloadThread;
|
scriptLoadUnloadThread = staticScriptLoadUnloadThread;
|
||||||
}
|
}
|
||||||
|
@ -196,21 +196,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
|
Thread.Sleep(scriptLoadUnloadThread_IdleSleepms);
|
||||||
//if (PleaseShutdown)
|
//if (PleaseShutdown)
|
||||||
// return;
|
// return;
|
||||||
if (LUQueue.Count > 0)
|
DoScriptLoadUnload();
|
||||||
{
|
|
||||||
LUStruct item = LUQueue.Dequeue();
|
|
||||||
lock (startStopLock) // Lock so we have only 1 thread working on loading/unloading of scripts
|
|
||||||
{
|
|
||||||
if (item.Action == LUType.Unload)
|
|
||||||
{
|
|
||||||
_StopScript(item.localID, item.itemID);
|
|
||||||
}
|
|
||||||
if (item.Action == LUType.Load)
|
|
||||||
{
|
|
||||||
_StartScript(item.localID, item.itemID, item.script);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ThreadAbortException tae)
|
catch (ThreadAbortException tae)
|
||||||
|
@ -221,6 +207,26 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DoScriptLoadUnload()
|
||||||
|
{
|
||||||
|
if (LUQueue.Count > 0)
|
||||||
|
{
|
||||||
|
LUStruct item = LUQueue.Dequeue();
|
||||||
|
lock (startStopLock) // Lock so we have only 1 thread working on loading/unloading of scripts
|
||||||
|
{
|
||||||
|
if (item.Action == LUType.Unload)
|
||||||
|
{
|
||||||
|
_StopScript(item.localID, item.itemID);
|
||||||
|
}
|
||||||
|
if (item.Action == LUType.Load)
|
||||||
|
{
|
||||||
|
_StartScript(item.localID, item.itemID, item.script);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Helper functions
|
#region Helper functions
|
||||||
|
|
Loading…
Reference in New Issue