diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 45 |
1 files changed, 37 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index 2f5b526..e4297c4 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -28,9 +28,12 @@ | |||
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; | ||
32 | using System.Diagnostics; | ||
31 | using OpenMetaverse; | 33 | using OpenMetaverse; |
32 | using log4net; | 34 | using log4net; |
33 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Region.Framework.Scenes; | ||
34 | using OpenSim.Region.ScriptEngine.Shared; | 37 | using OpenSim.Region.ScriptEngine.Shared; |
35 | using OpenSim.Region.ScriptEngine.Interfaces; | 38 | using OpenSim.Region.ScriptEngine.Interfaces; |
36 | 39 | ||
@@ -49,8 +52,13 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
49 | public interface IScriptWorkItem | 52 | public interface IScriptWorkItem |
50 | { | 53 | { |
51 | bool Cancel(); | 54 | bool Cancel(); |
52 | void Abort(); | 55 | bool Abort(); |
53 | bool Wait(TimeSpan t); | 56 | |
57 | /// <summary> | ||
58 | /// Wait for the work item to complete. | ||
59 | /// </summary> | ||
60 | /// <param name='t'>The number of milliseconds to wait. Must be >= -1 (Timeout.Infinite).</param> | ||
61 | bool Wait(int t); | ||
54 | } | 62 | } |
55 | 63 | ||
56 | /// <summary> | 64 | /// <summary> |
@@ -86,24 +94,35 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
86 | bool ShuttingDown { get; set; } | 94 | bool ShuttingDown { get; set; } |
87 | 95 | ||
88 | /// <summary> | 96 | /// <summary> |
97 | /// When stopping the script: should it remain stopped permanently (i.e., save !Running in its state)? | ||
98 | /// </summary> | ||
99 | bool StayStopped { get; set; } | ||
100 | |||
101 | /// <summary> | ||
89 | /// Script state | 102 | /// Script state |
90 | /// </summary> | 103 | /// </summary> |
91 | string State { get; set; } | 104 | string State { get; set; } |
92 | 105 | ||
93 | /// <summary> | 106 | /// <summary> |
107 | /// If true then the engine is responsible for persisted state. If false then some other component may | ||
108 | /// persist state (e.g. attachments persisting in assets). | ||
109 | /// </summary> | ||
110 | bool StatePersistedHere { get; } | ||
111 | |||
112 | /// <summary> | ||
94 | /// Time the script was last started | 113 | /// Time the script was last started |
95 | /// </summary> | 114 | /// </summary> |
96 | DateTime TimeStarted { get; } | 115 | DateTime TimeStarted { get; } |
97 | 116 | ||
98 | /// <summary> | 117 | /// <summary> |
99 | /// Tick the last measurement period was started. | 118 | /// Collects information about how long the script was executed. |
100 | /// </summary> | 119 | /// </summary> |
101 | long MeasurementPeriodTickStart { get; } | 120 | MetricsCollectorTime ExecutionTime { get; } |
102 | 121 | ||
103 | /// <summary> | 122 | /// <summary> |
104 | /// Ticks spent executing in the last measurement period. | 123 | /// Scene part in which this script instance is contained. |
105 | /// </summary> | 124 | /// </summary> |
106 | long MeasurementPeriodExecutionTime { get; } | 125 | SceneObjectPart Part { get; } |
107 | 126 | ||
108 | IScriptEngine Engine { get; } | 127 | IScriptEngine Engine { get; } |
109 | UUID AppDomain { get; set; } | 128 | UUID AppDomain { get; set; } |
@@ -124,6 +143,12 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
124 | 143 | ||
125 | uint LocalID { get; } | 144 | uint LocalID { get; } |
126 | UUID AssetID { get; } | 145 | UUID AssetID { get; } |
146 | |||
147 | /// <summary> | ||
148 | /// Inventory item containing the script used. | ||
149 | /// </summary> | ||
150 | TaskInventoryItem ScriptTask { get; } | ||
151 | |||
127 | Queue EventQueue { get; } | 152 | Queue EventQueue { get; } |
128 | 153 | ||
129 | /// <summary> | 154 | /// <summary> |
@@ -139,6 +164,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
139 | void ClearQueue(); | 164 | void ClearQueue(); |
140 | int StartParam { get; set; } | 165 | int StartParam { get; set; } |
141 | 166 | ||
167 | WaitHandle CoopWaitHandle { get; } | ||
168 | Stopwatch ExecutionTimer { get; } | ||
169 | |||
142 | void RemoveState(); | 170 | void RemoveState(); |
143 | 171 | ||
144 | void Init(); | 172 | void Init(); |
@@ -154,8 +182,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
154 | /// <param name="timeout"></param> | 182 | /// <param name="timeout"></param> |
155 | /// How many milliseconds we will wait for an existing script event to finish before | 183 | /// How many milliseconds we will wait for an existing script event to finish before |
156 | /// forcibly aborting that event. | 184 | /// forcibly aborting that event. |
185 | /// <param name="clearEventQueue">If true then the event queue is also cleared</param> | ||
157 | /// <returns>true if the script was successfully stopped, false otherwise</returns> | 186 | /// <returns>true if the script was successfully stopped, false otherwise</returns> |
158 | bool Stop(int timeout); | 187 | bool Stop(int timeout, bool clearEventQueue = false); |
159 | 188 | ||
160 | void SetState(string state); | 189 | void SetState(string state); |
161 | 190 | ||
@@ -204,7 +233,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
204 | void SetVars(Dictionary<string, object> vars); | 233 | void SetVars(Dictionary<string, object> vars); |
205 | DetectParams GetDetectParams(int idx); | 234 | DetectParams GetDetectParams(int idx); |
206 | UUID GetDetectID(int idx); | 235 | UUID GetDetectID(int idx); |
207 | void SaveState(string assembly); | 236 | void SaveState(); |
208 | void DestroyScriptInstance(); | 237 | void DestroyScriptInstance(); |
209 | 238 | ||
210 | IScriptApi GetApi(string name); | 239 | IScriptApi GetApi(string name); |