Refactor IScriptInstance / IScriptEngine to use a generic IScriptWorkItem,

which is a thin wrapper around a IWorkItemResult from the SmartThreadPool.
However, it is very easy to reimplement on top of basic threading and therefore
makes the IScriptInstance class independent of the specific threading
implementation.
This commit is contained in:
Melanie Thielker
2008-08-28 00:37:22 +00:00
parent 82aa9ba2b5
commit bf4d1fbb8d
5 changed files with 79 additions and 7 deletions

View File

@@ -53,7 +53,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public class ScriptInstance : IScriptInstance
{
private IScriptEngine m_Engine;
private IWorkItemResult m_CurrentResult=null;
private IScriptWorkItem m_CurrentResult=null;
private Queue m_EventQueue = new Queue(32);
private bool m_RunEvents = false;
private LLUUID m_ItemID;
@@ -346,7 +346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Stop(int timeout)
{
IWorkItemResult result;
IScriptWorkItem result;
lock (m_EventQueue)
{
@@ -370,7 +370,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_RunEvents = false;
}
if (SmartThreadPool.WaitAll(new IWorkItemResult[] {result}, new TimeSpan((long)timeout * 100000), false))
if (result.Wait(new TimeSpan((long)timeout * 100000)))
{
return true;
}