From f69e48bedca1e3aaae7ab0a1d681fccfe7af862f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 9 Jun 2017 17:32:07 +0100 Subject: make SendCoarseLocations async, since it is http. Make some actions use thread from pool and not a new one. Threading does need a deep cleanup one of this days. This stops mantis 8183 warnings, but as side effect only --- .../Region/CoreModules/Asset/FlotsamAssetCache.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 31 +++++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index e5ac17d..f2fc070 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -1168,7 +1168,7 @@ namespace OpenSim.Region.CoreModules.Asset con.Output("FloatSam Ensuring assets are cached for all scenes."); - WorkManager.RunInThread(delegate + WorkManager.RunInThreadPool(delegate { bool wasRunning= false; lock(timerLock) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e1e06d0..ebef158 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -394,6 +394,7 @@ namespace OpenSim.Region.Framework.Scenes /// asynchronously from the update loop. /// private bool m_cleaningTemps = false; + private bool m_sendingCoarseLocations = false; // same for async course locations sending /// /// Used to control main scene thread looping time when not updating via timer. @@ -1654,18 +1655,24 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_entitymovement == 0) m_sceneGraph.UpdateScenePresenceMovement(); - if (Frame % (m_update_coarse_locations) == 0) + if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations) { - List coarseLocations; - List avatarUUIDs; - - SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); - // Send coarse locations to clients - ForEachScenePresence(delegate(ScenePresence presence) - { - presence.SendCoarseLocations(coarseLocations, avatarUUIDs); - }); + m_sendingCoarseLocations = true; + WorkManager.RunInThreadPool( + delegate + { + List coarseLocations; + List avatarUUIDs; + SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); + // Send coarse locations to clients + ForEachScenePresence(delegate(ScenePresence presence) + { + presence.SendCoarseLocations(coarseLocations, avatarUUIDs); + }); + m_sendingCoarseLocations = false; + }, null, string.Format("SendCoarseLocations ({0})", Name)); } + // Get the simulation frame time that the avatar force input // took tmpMS2 = Util.GetTimeStampMS(); @@ -1708,7 +1715,7 @@ namespace OpenSim.Region.Framework.Scenes if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) { m_cleaningTemps = true; - WorkManager.RunInThread( + WorkManager.RunInThreadPool( delegate { CleanTempObjects(); m_cleaningTemps = false; }, null, string.Format("CleanTempObjects ({0})", Name)); tmpMS2 = Util.GetTimeStampMS(); tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects @@ -1936,7 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes if (!m_backingup) { m_backingup = true; - WorkManager.RunInThread(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); + WorkManager.RunInThreadPool(o => Backup(false), null, string.Format("BackupWorker ({0})", Name)); } } -- cgit v1.1