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

0.9.0-post-fixes
UbitUmarov 2017-06-09 17:32:07 +01:00
parent 3cddfddc3f
commit f69e48bedc
2 changed files with 20 additions and 13 deletions

View File

@ -1168,7 +1168,7 @@ namespace OpenSim.Region.CoreModules.Asset
con.Output("FloatSam Ensuring assets are cached for all scenes."); con.Output("FloatSam Ensuring assets are cached for all scenes.");
WorkManager.RunInThread(delegate WorkManager.RunInThreadPool(delegate
{ {
bool wasRunning= false; bool wasRunning= false;
lock(timerLock) lock(timerLock)

View File

@ -394,6 +394,7 @@ namespace OpenSim.Region.Framework.Scenes
/// asynchronously from the update loop. /// asynchronously from the update loop.
/// </summary> /// </summary>
private bool m_cleaningTemps = false; private bool m_cleaningTemps = false;
private bool m_sendingCoarseLocations = false; // same for async course locations sending
/// <summary> /// <summary>
/// Used to control main scene thread looping time when not updating via timer. /// 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) if (Frame % m_update_entitymovement == 0)
m_sceneGraph.UpdateScenePresenceMovement(); m_sceneGraph.UpdateScenePresenceMovement();
if (Frame % (m_update_coarse_locations) == 0) if (Frame % (m_update_coarse_locations) == 0 && !m_sendingCoarseLocations)
{ {
List<Vector3> coarseLocations; m_sendingCoarseLocations = true;
List<UUID> avatarUUIDs; WorkManager.RunInThreadPool(
delegate
SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60); {
// Send coarse locations to clients List<Vector3> coarseLocations;
ForEachScenePresence(delegate(ScenePresence presence) List<UUID> avatarUUIDs;
{ SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
presence.SendCoarseLocations(coarseLocations, avatarUUIDs); // 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 // Get the simulation frame time that the avatar force input
// took // took
tmpMS2 = Util.GetTimeStampMS(); tmpMS2 = Util.GetTimeStampMS();
@ -1708,7 +1715,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
{ {
m_cleaningTemps = true; m_cleaningTemps = true;
WorkManager.RunInThread( WorkManager.RunInThreadPool(
delegate { CleanTempObjects(); m_cleaningTemps = false; }, null, string.Format("CleanTempObjects ({0})", Name)); delegate { CleanTempObjects(); m_cleaningTemps = false; }, null, string.Format("CleanTempObjects ({0})", Name));
tmpMS2 = Util.GetTimeStampMS(); tmpMS2 = Util.GetTimeStampMS();
tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects
@ -1936,7 +1943,7 @@ namespace OpenSim.Region.Framework.Scenes
if (!m_backingup) if (!m_backingup)
{ {
m_backingup = true; 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));
} }
} }