From 32ccd5bb40447ea4d96f1181cf73edff3645a55a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 21 Oct 2009 23:03:18 -0700 Subject: * Changed the misc. methods calling ThreadPool.UnsafeQueueUserWorkItem() to Util.FireAndForget() * Changed Util.FireAndForget() to use any of five different methods set with async_call_method in the [Startup] section of OpenSim.ini. Look at the example config for possible values --- OpenSim/Region/Application/OpenSim.cs | 9 ++++++++- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 6 +++--- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 8 ++------ OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 143dd2a..5be1816 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -90,10 +90,17 @@ namespace OpenSim appender.File = fileName; appender.ActivateOptions(); } - m_log.InfoFormat("[LOGGING] Logging started to file {0}", appender.File); + m_log.InfoFormat("[LOGGING]: Logging started to file {0}", appender.File); } } + + string asyncCallMethodStr = startupConfig.GetString("async_call_method", String.Empty); + FireAndForgetMethod asyncCallMethod; + if (!String.IsNullOrEmpty(asyncCallMethodStr) && Utils.EnumTryParse(asyncCallMethodStr, out asyncCallMethod)) + Util.FireAndForgetMethod = asyncCallMethod; } + + m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); } /// diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 432fee7..0ba76ec 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -791,7 +791,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// heightmap public virtual void SendLayerData(float[] map) { - ThreadPool.UnsafeQueueUserWorkItem(DoSendLayerData, map); + Util.FireAndForget(DoSendLayerData, map); } /// @@ -931,7 +931,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// 16x16 array of wind speeds public virtual void SendWindData(Vector2[] windSpeeds) { - ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(DoSendWindData), (object)windSpeeds); + Util.FireAndForget(DoSendWindData, windSpeeds); } /// @@ -940,7 +940,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// 16x16 array of cloud densities public virtual void SendCloudData(float[] cloudDensity) { - ThreadPool.UnsafeQueueUserWorkItem(new WaitCallback(DoSendCloudData), (object)cloudDensity); + Util.FireAndForget(DoSendCloudData, cloudDensity); } /// diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index cbdca16..c6af806 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -302,12 +302,8 @@ namespace Flotsam.RegionModules.AssetCache } - ThreadPool.UnsafeQueueUserWorkItem( - delegate - { - WriteFileCache(filename, asset); - }, null - ); + Util.FireAndForget( + delegate { WriteFileCache(filename, asset); }); } } catch (Exception e) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 1260584..4e40084 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -1095,7 +1095,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // The reason is so we don't cause the thread to freeze waiting // for the 1 second it costs to start a thread manually. if (!threadrunning) - ThreadPool.UnsafeQueueUserWorkItem(this.StartThread, null); + Util.FireAndForget(this.StartThread); lock (m_rootAgents) { -- cgit v1.1