diff options
author | Charles Krinke | 2008-07-02 13:31:39 +0000 |
---|---|---|
committer | Charles Krinke | 2008-07-02 13:31:39 +0000 |
commit | 7580fa5c0aef318b32f7aa8bb8b0b011b08e1efa (patch) | |
tree | 9b92b25045afdd5bf4536488d20283c62f2399cb /OpenSim/Region/ScriptEngine | |
parent | From: Alan M Webb <awebb@vnet.ibm.com> (diff) | |
download | opensim-SC-7580fa5c0aef318b32f7aa8bb8b0b011b08e1efa.zip opensim-SC-7580fa5c0aef318b32f7aa8bb8b0b011b08e1efa.tar.gz opensim-SC-7580fa5c0aef318b32f7aa8bb8b0b011b08e1efa.tar.bz2 opensim-SC-7580fa5c0aef318b32f7aa8bb8b0b011b08e1efa.tar.xz |
Mantis#1648. Thank you, Melanie for a patch that:
Fix a script Xengine deadlock/hang if llResetScript is used in changed()
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
3 files changed, 27 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs index 856f228..0dab318 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptEngine.cs | |||
@@ -50,6 +50,7 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
50 | 50 | ||
51 | bool PostScriptEvent(LLUUID itemID, EventParams parms); | 51 | bool PostScriptEvent(LLUUID itemID, EventParams parms); |
52 | bool PostObjectEvent(uint localID, EventParams parms); | 52 | bool PostObjectEvent(uint localID, EventParams parms); |
53 | void ApiResetScript(LLUUID itemID); | ||
53 | void ResetScript(LLUUID itemID); | 54 | void ResetScript(LLUUID itemID); |
54 | void SetScriptState(LLUUID itemID, bool state); | 55 | void SetScriptState(LLUUID itemID, bool state); |
55 | bool GetScriptState(LLUUID itemID); | 56 | bool GetScriptState(LLUUID itemID); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 235b657..f4944cc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2767,7 +2767,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2767 | public void llResetScript() | 2767 | public void llResetScript() |
2768 | { | 2768 | { |
2769 | m_host.AddScriptLPS(1); | 2769 | m_host.AddScriptLPS(1); |
2770 | m_ScriptEngine.ResetScript(m_itemID); | 2770 | m_ScriptEngine.ApiResetScript(m_itemID); |
2771 | } | 2771 | } |
2772 | 2772 | ||
2773 | public void llMessageLinked(int linknum, int num, string msg, string id) | 2773 | public void llMessageLinked(int linknum, int num, string msg, string id) |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index b6f7fbc..5e3b91a 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -779,6 +779,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
779 | return false; | 779 | return false; |
780 | } | 780 | } |
781 | 781 | ||
782 | public void ApiResetScript(LLUUID itemID) | ||
783 | { | ||
784 | XScriptInstance instance = GetInstance(itemID); | ||
785 | if (instance != null) | ||
786 | instance.ApiResetScript(); | ||
787 | } | ||
788 | |||
782 | public void ResetScript(LLUUID itemID) | 789 | public void ResetScript(LLUUID itemID) |
783 | { | 790 | { |
784 | XScriptInstance instance = GetInstance(itemID); | 791 | XScriptInstance instance = GetInstance(itemID); |
@@ -1270,8 +1277,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1270 | } | 1277 | } |
1271 | else | 1278 | else |
1272 | { | 1279 | { |
1273 | m_CurrentEvent = data.EventName; | ||
1274 | // m_Engine.Log.DebugFormat("[XEngine] Processed event {0}", data.EventName); | ||
1275 | SceneObjectPart part = m_Engine.World.GetSceneObjectPart( | 1280 | SceneObjectPart part = m_Engine.World.GetSceneObjectPart( |
1276 | m_LocalID); | 1281 | m_LocalID); |
1277 | // m_Engine.Log.DebugFormat("[XEngine] Delivered event {2} in state {3} to {0}.{1}", | 1282 | // m_Engine.Log.DebugFormat("[XEngine] Delivered event {2} in state {3} to {0}.{1}", |
@@ -1279,10 +1284,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1279 | 1284 | ||
1280 | try | 1285 | try |
1281 | { | 1286 | { |
1287 | m_CurrentEvent = data.EventName; | ||
1282 | m_EventStart = DateTime.Now; | 1288 | m_EventStart = DateTime.Now; |
1283 | m_InEvent = true; | 1289 | m_InEvent = true; |
1290 | |||
1284 | m_Executor.ExecuteEvent(State, data.EventName, data.Params); | 1291 | m_Executor.ExecuteEvent(State, data.EventName, data.Params); |
1292 | |||
1285 | m_InEvent = false; | 1293 | m_InEvent = false; |
1294 | m_CurrentEvent = String.Empty; | ||
1286 | } | 1295 | } |
1287 | catch (Exception e) | 1296 | catch (Exception e) |
1288 | { | 1297 | { |
@@ -1358,6 +1367,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1358 | { | 1367 | { |
1359 | bool running = Running; | 1368 | bool running = Running; |
1360 | 1369 | ||
1370 | RemoveState(); | ||
1371 | |||
1361 | Stop(0); | 1372 | Stop(0); |
1362 | m_Engine.m_AsyncCommands.RemoveScript(m_LocalID, m_ItemID); | 1373 | m_Engine.m_AsyncCommands.RemoveScript(m_LocalID, m_ItemID); |
1363 | m_EventQueue.Clear(); | 1374 | m_EventQueue.Clear(); |
@@ -1365,6 +1376,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1365 | m_State = "default"; | 1376 | m_State = "default"; |
1366 | if (running) | 1377 | if (running) |
1367 | Start(); | 1378 | Start(); |
1379 | PostEvent(new EventParams("state_entry", | ||
1380 | new Object[0], new DetectParams[0])); | ||
1381 | } | ||
1382 | |||
1383 | public void ApiResetScript() | ||
1384 | { | ||
1385 | bool running = Running; | ||
1386 | |||
1387 | RemoveState(); | ||
1388 | |||
1389 | m_Script.ResetVars(); | ||
1390 | m_Engine.m_AsyncCommands.RemoveScript(m_LocalID, m_ItemID); | ||
1368 | if(m_CurrentEvent != "state_entry") | 1391 | if(m_CurrentEvent != "state_entry") |
1369 | { | 1392 | { |
1370 | PostEvent(new EventParams("state_entry", | 1393 | PostEvent(new EventParams("state_entry", |