diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
index 30e99b0d74..b9970bfc7e 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptApi.cs
@@ -46,6 +46,6 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// /param>
/// /param>
void Initialize(
- IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle);
+ IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item);
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
index b8fdd01d37..6355669e16 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs
@@ -110,5 +110,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
ParameterInfo[] ScriptBaseClassParameters { get; }
IScriptApi GetApi(UUID itemID, string name);
+
+ void SleepScript(UUID itemID, int delay);
}
}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 16641f790a..e4297c4daa 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -29,6 +29,7 @@ using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
+using System.Diagnostics;
using OpenMetaverse;
using log4net;
using OpenSim.Framework;
@@ -163,6 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void ClearQueue();
int StartParam { get; set; }
+ WaitHandle CoopWaitHandle { get; }
+ Stopwatch ExecutionTimer { get; }
+
void RemoveState();
void Init();
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 946680cd57..f364032fd5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -101,8 +101,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// Used for script sleeps when we are using co-operative script termination.
///
/// null if co-operative script termination is not active
- WaitHandle m_coopSleepHandle;
-
///
/// The item that hosts this script
///
@@ -262,12 +260,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
};
public void Initialize(
- IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
+ IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
m_ScriptEngine = scriptEngine;
m_host = host;
m_item = item;
- m_coopSleepHandle = coopSleepHandle;
LoadConfig();
@@ -406,21 +403,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected virtual void Sleep(int delay)
{
- if (m_coopSleepHandle == null)
- System.Threading.Thread.Sleep(delay);
- else
- CheckForCoopTermination(delay);
+ m_ScriptEngine.SleepScript(m_item.ItemID, delay);
}
///
/// Check for co-operative termination.
///
/// If called with 0, then just the check is performed with no wait.
- protected virtual void CheckForCoopTermination(int delay)
- {
- if (m_coopSleepHandle.WaitOne(delay))
- throw new ScriptCoopStopException();
- }
public Scene World
{
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 3406aea31a..e5e43f80fd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -63,7 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal IScriptModuleComms m_comms = null;
public void Initialize(
- IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
+ IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
m_ScriptEngine = scriptEngine;
m_host = host;
@@ -833,4 +833,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return success;
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 92dd8137d9..9929dac46f 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
internal IScriptModuleComms m_comms = null;
public void Initialize(
- IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
+ IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
m_ScriptEngine = scriptEngine;
m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
index 123f8ca8e6..c1f1ed568a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -145,7 +145,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
protected IUrlModule m_UrlModule = null;
public void Initialize(
- IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
+ IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item)
{
m_ScriptEngine = scriptEngine;
m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 8a744c30ae..fa6e6fc67e 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -100,6 +100,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public int DebugLevel { get; set; }
+ public WaitHandle CoopWaitHandle { get; private set; }
+ public Stopwatch ExecutionTimer { get; private set; }
+
public Dictionary, KeyValuePair> LineMap { get; set; }
private Dictionary m_Apis = new Dictionary();
@@ -234,6 +237,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
State = "default";
EventQueue = new Queue(32);
+ ExecutionTimer = new Stopwatch();
Engine = engine;
Part = part;
@@ -286,12 +290,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_stateSource = stateSource;
m_coopTermination = coopTermination;
+ if (m_coopTermination)
+ CoopWaitHandle = coopSleepHandle;
+ else
+ CoopWaitHandle = null;
+
ApiManager am = new ApiManager();
foreach (string api in am.GetApis())
{
m_Apis[api] = am.CreateApi(api);
- m_Apis[api].Initialize(Engine, Part, ScriptTask, m_coopSleepHandle);
+ m_Apis[api].Initialize(Engine, Part, ScriptTask);
}
try
@@ -766,8 +775,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (Suspended)
return 0;
- Stopwatch timer = new Stopwatch();
- timer.Start();
+ ExecutionTimer.Restart();
try
{
@@ -775,9 +783,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
finally
{
- timer.Stop();
- ExecutionTime.AddSample(timer);
- Part.ParentGroup.Scene.AddScriptExecutionTime(timer.ElapsedTicks);
+ ExecutionTimer.Stop();
+ ExecutionTime.AddSample(ExecutionTimer);
+ Part.ParentGroup.Scene.AddScriptExecutionTime(ExecutionTimer.ElapsedTicks);
}
}
}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
index 8170e9b9f6..af1da7c5d5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiAvatarTests.cs
@@ -95,7 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
part.RotationOffset = new Quaternion(0.7071068f, 0, 0, 0.7071068f);
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, part, null, null);
+ apiGrp1.Initialize(m_engine, part, null);
ScenePresence sp = SceneHelpers.AddScenePresence(m_scene, userId);
@@ -155,4 +155,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
index e35de9c762..9a5ebce6d9 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiHttpTests.cs
@@ -105,7 +105,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
// Possibly this could be done and we could obtain it directly from the MockScriptEngine.
m_lslApi = new LSL_Api();
- m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem, null);
+ m_lslApi.Initialize(m_engine, so.RootPart, m_scriptItem);
}
[TearDown]
@@ -245,4 +245,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
index 3ff4c6b747..9b7cab20ed 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiInventoryTests.cs
@@ -94,7 +94,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TaskInventoryHelpers.AddSceneObject(m_scene.AssetService, so1.RootPart, inventoryItemName, itemId, userId);
LSL_Api api = new LSL_Api();
- api.Initialize(m_engine, so1.RootPart, null, null);
+ api.Initialize(m_engine, so1.RootPart, null);
// Create a second object
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, userId, "so2", 0x100);
@@ -127,7 +127,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
m_scene.AddSceneObject(so1);
LSL_Api api = new LSL_Api();
- api.Initialize(m_engine, so1.RootPart, null, null);
+ api.Initialize(m_engine, so1.RootPart, null);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
@@ -137,7 +137,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup so2 = SceneHelpers.CreateSceneObject(1, user2Id, "so2", 0x100);
m_scene.AddSceneObject(so2);
LSL_Api api2 = new LSL_Api();
- api2.Initialize(m_engine, so2.RootPart, null, null);
+ api2.Initialize(m_engine, so2.RootPart, null);
// *** Firstly, we test where llAllowInventoryDrop() has not been called. ***
api.llGiveInventory(so2.UUID.ToString(), inventoryItemName);
@@ -184,7 +184,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
m_scene.AddSceneObject(so1);
LSL_Api api = new LSL_Api();
- api.Initialize(m_engine, so1.RootPart, null, null);
+ api.Initialize(m_engine, so1.RootPart, null);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
@@ -218,7 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup so1 = SceneHelpers.CreateSceneObject(1, user1Id, "so1", 0x10);
m_scene.AddSceneObject(so1);
LSL_Api api = new LSL_Api();
- api.Initialize(m_engine, so1.RootPart, null, null);
+ api.Initialize(m_engine, so1.RootPart, null);
// Create an object embedded inside the first
UUID itemId = TestHelpers.ParseTail(0x20);
@@ -250,7 +250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup sourceSo = SceneHelpers.AddSceneObject(m_scene, "sourceSo", user1Id);
m_scene.AddSceneObject(sourceSo);
LSL_Api api = new LSL_Api();
- api.Initialize(m_engine, sourceSo.RootPart, null, null);
+ api.Initialize(m_engine, sourceSo.RootPart, null);
TaskInventoryHelpers.AddScript(m_scene.AssetService, sourceSo.RootPart, "script", "Hello World");
SceneObjectGroup targetSo = SceneHelpers.AddSceneObject(m_scene, "targetSo", user1Id);
@@ -285,4 +285,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.IsNull(otherOwnedTargetSo.RootPart.Inventory.GetInventoryItem("script"));
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
index b6f5e099c2..14b1890beb 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiLinkingTests.cs
@@ -104,7 +104,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(grp2);
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
+ apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
apiGrp1.llCreateLink(grp2.UUID.ToString(), ScriptBaseClass.TRUE);
@@ -131,7 +131,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
+ apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
apiGrp1.llBreakLink(2);
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
grp1Item.PermsMask |= ScriptBaseClass.PERMISSION_CHANGE_LINKS;
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item, null);
+ apiGrp1.Initialize(m_engine, grp1.RootPart, grp1Item);
apiGrp1.llBreakAllLinks();
@@ -183,4 +183,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
index 0b1ae6070d..34a29e68c1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiListTests.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
engine.AddRegion(scene);
m_lslApi = new LSL_Api();
- m_lslApi.Initialize(engine, part, null, null);
+ m_lslApi.Initialize(engine, part, null);
}
[Test]
@@ -133,4 +133,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
}
- }
\ No newline at end of file
+ }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
index 2ac12cb890..9ab3115bc5 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiNotecardTests.cs
@@ -66,7 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// This is disconnected from the actual script - the mock engine does not set up any LSL_Api atm.
// Possibly this could be done and we could obtain it directly from the MockScriptEngine.
m_lslApi = new LSL_Api();
- m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem, null);
+ m_lslApi.Initialize(m_engine, m_so.RootPart, m_scriptItem);
}
[Test]
@@ -266,4 +266,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
// }
// }
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
index caf2b05452..d957bf24b8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiObjectTests.cs
@@ -89,7 +89,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(grp1);
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, grp1.RootPart, null, null);
+ apiGrp1.Initialize(m_engine, grp1.RootPart, null);
// Check simple 1 prim case
{
@@ -167,7 +167,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.That(scene.AddNewSceneObject(new SceneObjectGroup(part1), false), Is.True);
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, part1, null, null);
+ apiGrp1.Initialize(m_engine, part1, null);
// Note that prim hollow check is passed with the other prim params in order to allow the
// specification of a different check value from the prim param. A cylinder, prism, sphere,
@@ -395,4 +395,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
index 1b7aa63871..d929da8148 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiTest.cs
@@ -65,7 +65,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
engine.AddRegion(scene);
m_lslApi = new LSL_Api();
- m_lslApi.Initialize(engine, part, null, null);
+ m_lslApi.Initialize(engine, part, null);
}
[Test]
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
index 40082b5c4d..a8964bf222 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/LSL_ApiUserTests.cs
@@ -71,7 +71,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, part);
LSL_Api apiGrp1 = new LSL_Api();
- apiGrp1.Initialize(m_engine, part, scriptItem, null);
+ apiGrp1.Initialize(m_engine, part, scriptItem);
// Initially long timeout to test cache
apiGrp1.LlRequestAgentDataCacheTimeoutMs = 20000;
@@ -154,4 +154,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
}
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
index 4c3196974a..2f9a5641bd 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAppearanceTest.cs
@@ -93,7 +93,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
string notecardName = "appearanceNc";
@@ -134,7 +134,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
string notecardName = "appearanceNc";
@@ -158,4 +158,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.That(savedAppearance.AvatarHeight, Is.EqualTo(sp.Appearance.AvatarHeight));
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
index 2fe558a7e6..b6b3f12e42 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiAttachmentTests.cs
@@ -98,9 +98,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
- new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
// SceneObjectGroup sog1 = SceneHelpers.CreateSceneObject(1, ua1.PrincipalID);
@@ -144,9 +144,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
- new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
// Create an object embedded inside the first
TaskInventoryHelpers.AddNotecard(
@@ -192,9 +192,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
SceneObjectGroup inWorldObj = SceneHelpers.AddSceneObject(m_scene, "inWorldObj", ua1.PrincipalID);
TaskInventoryItem scriptItem = TaskInventoryHelpers.AddScript(m_scene.AssetService, inWorldObj.RootPart);
- new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ new LSL_Api().Initialize(m_engine, inWorldObj.RootPart, scriptItem);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem, null);
+ osslApi.Initialize(m_engine, inWorldObj.RootPart, scriptItem);
// Create an object embedded inside the first
TaskInventoryHelpers.AddSceneObject(
@@ -229,4 +229,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.That(sp2.Appearance.GetAttachpoint(attachmentsInAppearance2[0].ItemID), Is.EqualTo((uint)attachPoint));
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
index 398ccbe465..99bff832ff 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Tests/OSSL_ApiNpcTests.cs
@@ -99,7 +99,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
string notecardName = "appearanceNc";
osslApi.osOwnerSaveAppearance(notecardName);
@@ -125,7 +125,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, so.RootPart, null, null);
+ osslApi.Initialize(m_engine, so.RootPart, null);
bool gotExpectedException = false;
try
@@ -160,7 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
string notecardName = "appearanceNc";
osslApi.osOwnerSaveAppearance(notecardName);
@@ -195,7 +195,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
@@ -233,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
osslApi.osOwnerSaveAppearance(firstAppearanceNcName);
@@ -285,10 +285,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(otherSo);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
OSSL_Api otherOsslApi = new OSSL_Api();
- otherOsslApi.Initialize(m_engine, otherPart, null, null);
+ otherOsslApi.Initialize(m_engine, otherPart, null);
string notecardName = "appearanceNc";
osslApi.osOwnerSaveAppearance(notecardName);
@@ -332,7 +332,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
m_scene.AddSceneObject(so);
OSSL_Api osslApi = new OSSL_Api();
- osslApi.Initialize(m_engine, part, null, null);
+ osslApi.Initialize(m_engine, part, null);
string notecardName = "appearanceNc";
osslApi.osOwnerSaveAppearance(notecardName);
@@ -348,4 +348,4 @@ namespace OpenSim.Region.ScriptEngine.Shared.Tests
Assert.That(npc, Is.Null);
}
}
-}
\ No newline at end of file
+}
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 62bf803048..78d4ee9d9d 100755
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -2435,5 +2435,30 @@ namespace OpenSim.Region.ScriptEngine.XEngine
running = instance.Running;
return true;
}
+
+ public void SleepScript(UUID itemID, int delay)
+ {
+ IScriptInstance instance = GetInstance(itemID);
+ if (instance == null)
+ return;
+
+ instance.ExecutionTimer.Stop();
+ try
+ {
+ if (instance.CoopWaitHandle != null)
+ {
+ if (instance.CoopWaitHandle.WaitOne(delay))
+ throw new ScriptCoopStopException();
+ }
+ else
+ {
+ Thread.Sleep(delay);
+ }
+ }
+ finally
+ {
+ instance.ExecutionTimer.Start();
+ }
+ }
}
}
diff --git a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
index 57be1da945..d7a144c886 100644
--- a/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
+++ b/OpenSim/Tests/Common/Mock/MockScriptEngine.cs
@@ -264,5 +264,9 @@ namespace OpenSim.Tests.Common
{
PostedEvents.Clear();
}
+
+ public void SleepScript(UUID itemID, int delay)
+ {
+ }
}
}