From 2a060136bd89174a3071de9458c25af133c01b64 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 6 Oct 2009 15:28:38 +0100
Subject: Lock the heartbeat against multiple invocations. May prevent
deadlocks and/or runaway thread use
---
OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index d0dc021..c863c3b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,6 +137,8 @@ namespace OpenSim.Region.Framework.Scenes
protected IAssetService m_AssetService = null;
protected IAuthorizationService m_AuthorizationService = null;
+ private Object m_heartbeatLock = new Object();
+
public IAssetService AssetService
{
get
@@ -942,6 +944,9 @@ namespace OpenSim.Region.Framework.Scenes
///
private void Heartbeat(object sender)
{
+ if (!Monitor.TryEnter(m_heartbeatLock))
+ return;
+
try
{
Update();
@@ -952,6 +957,11 @@ namespace OpenSim.Region.Framework.Scenes
catch (ThreadAbortException)
{
}
+ finally
+ {
+ Monitor.Pulse(m_heartbeatLock);
+ Monitor.Exit(m_heartbeatLock);
+ }
}
///
--
cgit v1.1