aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs24
4 files changed, 9 insertions, 51 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b4a8620..946680c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -104,11 +104,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
104 WaitHandle m_coopSleepHandle; 104 WaitHandle m_coopSleepHandle;
105 105
106 /// <summary> 106 /// <summary>
107 /// The timer used by the ScriptInstance to measure how long the script has executed.
108 /// </summary>
109 private Stopwatch m_executionTimer;
110
111 /// <summary>
112 /// The item that hosts this script 107 /// The item that hosts this script
113 /// </summary> 108 /// </summary>
114 protected TaskInventoryItem m_item; 109 protected TaskInventoryItem m_item;
@@ -267,14 +262,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
267 }; 262 };
268 263
269 public void Initialize( 264 public void Initialize(
270 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle, 265 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
271 Stopwatch executionTimer)
272 { 266 {
273 m_ScriptEngine = scriptEngine; 267 m_ScriptEngine = scriptEngine;
274 m_host = host; 268 m_host = host;
275 m_item = item; 269 m_item = item;
276 m_coopSleepHandle = coopSleepHandle; 270 m_coopSleepHandle = coopSleepHandle;
277 m_executionTimer = executionTimer;
278 271
279 LoadConfig(); 272 LoadConfig();
280 273
@@ -413,21 +406,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
413 406
414 protected virtual void Sleep(int delay) 407 protected virtual void Sleep(int delay)
415 { 408 {
416 if (m_executionTimer != null) 409 if (m_coopSleepHandle == null)
417 m_executionTimer.Stop(); // sleep time doesn't count as execution time, since it doesn't use the CPU 410 System.Threading.Thread.Sleep(delay);
418 411 else
419 try 412 CheckForCoopTermination(delay);
420 {
421 if (m_coopSleepHandle == null)
422 System.Threading.Thread.Sleep(delay);
423 else
424 CheckForCoopTermination(delay);
425 }
426 finally
427 {
428 if (m_executionTimer != null)
429 m_executionTimer.Start();
430 }
431 } 413 }
432 414
433 /// <summary> 415 /// <summary>
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
index 9bb12d3..3406aea 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs
@@ -51,7 +51,6 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
54using System.Diagnostics;
55 54
56namespace OpenSim.Region.ScriptEngine.Shared.Api 55namespace OpenSim.Region.ScriptEngine.Shared.Api
57{ 56{
@@ -64,8 +63,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
64 internal IScriptModuleComms m_comms = null; 63 internal IScriptModuleComms m_comms = null;
65 64
66 public void Initialize( 65 public void Initialize(
67 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle, 66 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
68 Stopwatch executionTimer)
69 { 67 {
70 m_ScriptEngine = scriptEngine; 68 m_ScriptEngine = scriptEngine;
71 m_host = host; 69 m_host = host;
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
index 39505e1..92dd813 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs
@@ -51,7 +51,6 @@ using LSL_List = OpenSim.Region.ScriptEngine.Shared.LSL_Types.list;
51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion; 51using LSL_Rotation = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Quaternion;
52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString; 52using LSL_String = OpenSim.Region.ScriptEngine.Shared.LSL_Types.LSLString;
53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3; 53using LSL_Vector = OpenSim.Region.ScriptEngine.Shared.LSL_Types.Vector3;
54using System.Diagnostics;
55 54
56namespace OpenSim.Region.ScriptEngine.Shared.Api 55namespace OpenSim.Region.ScriptEngine.Shared.Api
57{ 56{
@@ -67,8 +66,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
67 internal IScriptModuleComms m_comms = null; 66 internal IScriptModuleComms m_comms = null;
68 67
69 public void Initialize( 68 public void Initialize(
70 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle, 69 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
71 Stopwatch executionTimer)
72 { 70 {
73 m_ScriptEngine = scriptEngine; 71 m_ScriptEngine = scriptEngine;
74 m_host = host; 72 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 4bb0b74..123f8ca 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
@@ -41,7 +41,6 @@ using OpenMetaverse.StructuredData;
41using Nini.Config; 41using Nini.Config;
42using OpenSim; 42using OpenSim;
43using OpenSim.Framework; 43using OpenSim.Framework;
44using System.Diagnostics;
45 44
46using OpenSim.Framework.Console; 45using OpenSim.Framework.Console;
47using OpenSim.Region.Framework.Interfaces; 46using OpenSim.Region.Framework.Interfaces;
@@ -143,21 +142,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
143 internal float m_ScriptDistanceFactor = 1.0f; 142 internal float m_ScriptDistanceFactor = 1.0f;
144 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); 143 internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >();
145 144
146 /// <summary>
147 /// The timer used by the ScriptInstance to measure how long the script has executed.
148 /// </summary>
149 private Stopwatch m_executionTimer;
150
151 protected IUrlModule m_UrlModule = null; 145 protected IUrlModule m_UrlModule = null;
152 146
153 public void Initialize( 147 public void Initialize(
154 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle, 148 IScriptEngine scriptEngine, SceneObjectPart host, TaskInventoryItem item, WaitHandle coopSleepHandle)
155 Stopwatch executionTimer)
156 { 149 {
157 m_ScriptEngine = scriptEngine; 150 m_ScriptEngine = scriptEngine;
158 m_host = host; 151 m_host = host;
159 m_item = item; 152 m_item = item;
160 m_executionTimer = executionTimer;
161 153
162 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); 154 m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>();
163 155
@@ -440,19 +432,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
440 delay = (int)((float)delay * m_ScriptDelayFactor); 432 delay = (int)((float)delay * m_ScriptDelayFactor);
441 if (delay == 0) 433 if (delay == 0)
442 return; 434 return;
443 435 System.Threading.Thread.Sleep(delay);
444 if (m_executionTimer != null)
445 m_executionTimer.Stop(); // sleep time doesn't count as execution time, since it doesn't use the CPU
446
447 try
448 {
449 System.Threading.Thread.Sleep(delay);
450 }
451 finally
452 {
453 if (m_executionTimer != null)
454 m_executionTimer.Start();
455 }
456 } 436 }
457 437
458 public LSL_Integer osSetTerrainHeight(int x, int y, double val) 438 public LSL_Integer osSetTerrainHeight(int x, int y, double val)