diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 73 |
1 files changed, 71 insertions, 2 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index b04f6b6..35ae44c 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -28,9 +28,11 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.Threading; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.ScriptEngine.Shared; | 36 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 37 | using OpenSim.Region.ScriptEngine.Interfaces; |
36 | 38 | ||
@@ -50,7 +52,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
50 | { | 52 | { |
51 | bool Cancel(); | 53 | bool Cancel(); |
52 | void Abort(); | 54 | void Abort(); |
53 | bool Wait(TimeSpan t); | 55 | |
56 | /// <summary> | ||
57 | /// Wait for the work item to complete. | ||
58 | /// </summary> | ||
59 | /// <param name='t'>The number of milliseconds to wait. Must be >= -1 (Timeout.Infinite).</param> | ||
60 | bool Wait(int t); | ||
54 | } | 61 | } |
55 | 62 | ||
56 | /// <summary> | 63 | /// <summary> |
@@ -59,6 +66,18 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
59 | public interface IScriptInstance | 66 | public interface IScriptInstance |
60 | { | 67 | { |
61 | /// <summary> | 68 | /// <summary> |
69 | /// Debug level for this script instance. | ||
70 | /// </summary> | ||
71 | /// <remarks> | ||
72 | /// Level == 0, no extra data is logged. | ||
73 | /// Level >= 1, state changes are logged. | ||
74 | /// Level >= 2, event firing is logged. | ||
75 | /// <value> | ||
76 | /// The debug level. | ||
77 | /// </value> | ||
78 | int DebugLevel { get; set; } | ||
79 | |||
80 | /// <summary> | ||
62 | /// Is the script currently running? | 81 | /// Is the script currently running? |
63 | /// </summary> | 82 | /// </summary> |
64 | bool Running { get; set; } | 83 | bool Running { get; set; } |
@@ -93,6 +112,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
93 | /// </summary> | 112 | /// </summary> |
94 | long MeasurementPeriodExecutionTime { get; } | 113 | long MeasurementPeriodExecutionTime { get; } |
95 | 114 | ||
115 | /// <summary> | ||
116 | /// Scene part in which this script instance is contained. | ||
117 | /// </summary> | ||
118 | SceneObjectPart Part { get; } | ||
119 | |||
96 | IScriptEngine Engine { get; } | 120 | IScriptEngine Engine { get; } |
97 | UUID AppDomain { get; set; } | 121 | UUID AppDomain { get; set; } |
98 | string PrimName { get; } | 122 | string PrimName { get; } |
@@ -112,8 +136,24 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
112 | 136 | ||
113 | uint LocalID { get; } | 137 | uint LocalID { get; } |
114 | UUID AssetID { get; } | 138 | UUID AssetID { get; } |
139 | |||
140 | /// <summary> | ||
141 | /// Inventory item containing the script used. | ||
142 | /// </summary> | ||
143 | TaskInventoryItem ScriptTask { get; } | ||
144 | |||
115 | Queue EventQueue { get; } | 145 | Queue EventQueue { get; } |
116 | 146 | ||
147 | /// <summary> | ||
148 | /// Number of events queued for processing. | ||
149 | /// </summary> | ||
150 | long EventsQueued { get; } | ||
151 | |||
152 | /// <summary> | ||
153 | /// Number of events processed by this script instance. | ||
154 | /// </summary> | ||
155 | long EventsProcessed { get; } | ||
156 | |||
117 | void ClearQueue(); | 157 | void ClearQueue(); |
118 | int StartParam { get; set; } | 158 | int StartParam { get; set; } |
119 | 159 | ||
@@ -125,7 +165,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
125 | /// <summary> | 165 | /// <summary> |
126 | /// Stop the script instance. | 166 | /// Stop the script instance. |
127 | /// </summary> | 167 | /// </summary> |
168 | /// <remarks> | ||
169 | /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise | ||
170 | /// there is a danger that it will self-abort and not complete the reset. | ||
171 | /// </remarks> | ||
128 | /// <param name="timeout"></param> | 172 | /// <param name="timeout"></param> |
173 | /// How many milliseconds we will wait for an existing script event to finish before | ||
174 | /// forcibly aborting that event. | ||
129 | /// <returns>true if the script was successfully stopped, false otherwise</returns> | 175 | /// <returns>true if the script was successfully stopped, false otherwise</returns> |
130 | bool Stop(int timeout); | 176 | bool Stop(int timeout); |
131 | 177 | ||
@@ -147,8 +193,31 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
147 | object EventProcessor(); | 193 | object EventProcessor(); |
148 | 194 | ||
149 | int EventTime(); | 195 | int EventTime(); |
150 | void ResetScript(); | 196 | |
197 | /// <summary> | ||
198 | /// Reset the script. | ||
199 | /// </summary> | ||
200 | /// <remarks> | ||
201 | /// This must not be called by a thread that is in the process of handling an event for this script. Otherwise | ||
202 | /// there is a danger that it will self-abort and not complete the reset. Such a thread must call | ||
203 | /// ApiResetScript() instead. | ||
204 | /// </remarks> | ||
205 | /// <param name='timeout'> | ||
206 | /// How many milliseconds we will wait for an existing script event to finish before | ||
207 | /// forcibly aborting that event prior to script reset. | ||
208 | /// </param> | ||
209 | void ResetScript(int timeout); | ||
210 | |||
211 | /// <summary> | ||
212 | /// Reset the script. | ||
213 | /// </summary> | ||
214 | /// <remarks> | ||
215 | /// This must not be called by any thread other than the one executing the scripts current event. This is | ||
216 | /// because there is no wait or abort logic if another thread is in the middle of processing a script event. | ||
217 | /// Such an external thread should use ResetScript() instead. | ||
218 | /// </remarks> | ||
151 | void ApiResetScript(); | 219 | void ApiResetScript(); |
220 | |||
152 | Dictionary<string, object> GetVars(); | 221 | Dictionary<string, object> GetVars(); |
153 | void SetVars(Dictionary<string, object> vars); | 222 | void SetVars(Dictionary<string, object> vars); |
154 | DetectParams GetDetectParams(int idx); | 223 | DetectParams GetDetectParams(int idx); |