From b1ff78f4d8265dbb3e8f5bc1d1c9cfad284f7ef3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 26 Aug 2014 18:52:09 +0100 Subject: [PATCH] Don't allow update timer to invoke another scene update if the previous is still active. --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index de89cc231d..e87500ac85 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1443,8 +1443,15 @@ namespace OpenSim.Region.Framework.Scenes } } + private volatile bool m_isTimerUpdateRunning; + private void Update(object sender, ElapsedEventArgs e) - { + { + if (m_isTimerUpdateRunning) + return; + + m_isTimerUpdateRunning = true; + // If the last frame did not complete on time, then immediately start the next update on the same thread // and ignore further timed updates until we have a frame that had spare time. while (!Update(1) && Active) {} @@ -1455,6 +1462,8 @@ namespace OpenSim.Region.Framework.Scenes m_sceneUpdateTimer = null; m_isRunning = false; } + + m_isTimerUpdateRunning = false; } private void Maintenance()