diff options
author | Justin Clark-Casey (justincc) | 2012-03-15 00:48:19 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-15 00:48:44 +0000 |
commit | 5ddda892388fe22912d8992f1c9d24b3667926f0 (patch) | |
tree | fae4e35fe93d818d3ef7695a0811e1daceaeda58 /OpenSim/Region/ScriptEngine | |
parent | Fix a problem where multiple near simultaneous calls to llDie() from multiple... (diff) | |
download | opensim-SC_OLD-5ddda892388fe22912d8992f1c9d24b3667926f0.zip opensim-SC_OLD-5ddda892388fe22912d8992f1c9d24b3667926f0.tar.gz opensim-SC_OLD-5ddda892388fe22912d8992f1c9d24b3667926f0.tar.bz2 opensim-SC_OLD-5ddda892388fe22912d8992f1c9d24b3667926f0.tar.xz |
Remove duplication of m_RunEvents and Running
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 6a9cd72..cc4be73 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -68,7 +68,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
68 | private IScriptWorkItem m_CurrentWorkItem; | 68 | private IScriptWorkItem m_CurrentWorkItem; |
69 | 69 | ||
70 | private Queue m_EventQueue = new Queue(32); | 70 | private Queue m_EventQueue = new Queue(32); |
71 | private bool m_RunEvents = false; | ||
72 | private UUID m_ItemID; | 71 | private UUID m_ItemID; |
73 | private uint m_LocalID; | 72 | private uint m_LocalID; |
74 | private UUID m_ObjectID; | 73 | private UUID m_ObjectID; |
@@ -141,11 +140,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
141 | } | 140 | } |
142 | } | 141 | } |
143 | 142 | ||
144 | public bool Running | 143 | public bool Running { get; set; } |
145 | { | ||
146 | get { return m_RunEvents; } | ||
147 | set { m_RunEvents = value; } | ||
148 | } | ||
149 | 144 | ||
150 | public bool Suspended | 145 | public bool Suspended |
151 | { | 146 | { |
@@ -164,7 +159,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
164 | lock (m_EventQueue) | 159 | lock (m_EventQueue) |
165 | { | 160 | { |
166 | // Need to place ourselves back in a work item if there are events to process | 161 | // Need to place ourselves back in a work item if there are events to process |
167 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 162 | if ((m_EventQueue.Count > 0) && Running && (!m_ShuttingDown)) |
168 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); | 163 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
169 | } | 164 | } |
170 | } | 165 | } |
@@ -369,13 +364,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
369 | part.SetScriptEvents(m_ItemID, | 364 | part.SetScriptEvents(m_ItemID, |
370 | (int)m_Script.GetStateEventFlags(State)); | 365 | (int)m_Script.GetStateEventFlags(State)); |
371 | 366 | ||
372 | if (m_RunEvents && (!m_ShuttingDown)) | 367 | if (Running && (!m_ShuttingDown)) |
373 | { | 368 | { |
374 | m_RunEvents = false; | 369 | Running = false; |
375 | } | 370 | } |
376 | else | 371 | else |
377 | { | 372 | { |
378 | m_RunEvents = false; | 373 | Running = false; |
379 | m_startOnInit = false; | 374 | m_startOnInit = false; |
380 | } | 375 | } |
381 | 376 | ||
@@ -531,7 +526,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
531 | if (Running) | 526 | if (Running) |
532 | return; | 527 | return; |
533 | 528 | ||
534 | m_RunEvents = true; | 529 | Running = true; |
535 | 530 | ||
536 | if (m_EventQueue.Count > 0) | 531 | if (m_EventQueue.Count > 0) |
537 | { | 532 | { |
@@ -559,7 +554,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
559 | // If we're not running or waiting to run an event then we can safely stop. | 554 | // If we're not running or waiting to run an event then we can safely stop. |
560 | if (m_CurrentWorkItem == null) | 555 | if (m_CurrentWorkItem == null) |
561 | { | 556 | { |
562 | m_RunEvents = false; | 557 | Running = false; |
563 | return true; | 558 | return true; |
564 | } | 559 | } |
565 | 560 | ||
@@ -567,12 +562,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
567 | if (m_CurrentWorkItem.Cancel()) | 562 | if (m_CurrentWorkItem.Cancel()) |
568 | { | 563 | { |
569 | m_CurrentWorkItem = null; | 564 | m_CurrentWorkItem = null; |
570 | m_RunEvents = false; | 565 | Running = false; |
571 | return true; | 566 | return true; |
572 | } | 567 | } |
573 | 568 | ||
574 | workItem = m_CurrentWorkItem; | 569 | workItem = m_CurrentWorkItem; |
575 | m_RunEvents = false; | 570 | Running = false; |
576 | } | 571 | } |
577 | 572 | ||
578 | // Wait for the current event to complete. | 573 | // Wait for the current event to complete. |
@@ -727,7 +722,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
727 | data = (EventParams) m_EventQueue.Dequeue(); | 722 | data = (EventParams) m_EventQueue.Dequeue(); |
728 | if (data == null) // Shouldn't happen | 723 | if (data == null) // Shouldn't happen |
729 | { | 724 | { |
730 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 725 | if (m_EventQueue.Count > 0 && Running && !m_ShuttingDown) |
731 | { | 726 | { |
732 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); | 727 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
733 | } | 728 | } |
@@ -853,12 +848,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
853 | } | 848 | } |
854 | } | 849 | } |
855 | 850 | ||
856 | |||
857 | // If there are more events and we are currently running and not shutting down, then ask the | 851 | // If there are more events and we are currently running and not shutting down, then ask the |
858 | // script engine to run the next event. | 852 | // script engine to run the next event. |
859 | lock (m_EventQueue) | 853 | lock (m_EventQueue) |
860 | { | 854 | { |
861 | if ((m_EventQueue.Count > 0) && m_RunEvents && (!m_ShuttingDown)) | 855 | if (m_EventQueue.Count > 0 && Running && (!m_ShuttingDown)) |
862 | { | 856 | { |
863 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); | 857 | m_CurrentWorkItem = m_Engine.QueueEventHandler(this); |
864 | } | 858 | } |