|
@@ -69,8 +69,6 @@ namespace OpenSim.Framework
|
|
|
/// </summary>
|
|
|
public class Util
|
|
|
{
|
|
|
- private static SmartThreadPool m_ThreadPool = null;
|
|
|
-
|
|
|
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
|
|
|
|
|
|
private static uint nextXferID = 5000;
|
|
@@ -79,6 +77,9 @@ namespace OpenSim.Framework
|
|
|
private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
|
|
|
private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
|
|
|
private static object XferLock = new object();
|
|
|
+ /// <summary>Thread pool used for Util.FireAndForget if
|
|
|
+ /// FireAndForgetMethod.SmartThreadPool is used</summary>
|
|
|
+ private static SmartThreadPool m_ThreadPool;
|
|
|
|
|
|
// Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
|
|
|
private static readonly DateTime unixEpoch =
|
|
@@ -1319,8 +1320,11 @@ namespace OpenSim.Framework
|
|
|
FireAndForget(callback, null);
|
|
|
}
|
|
|
|
|
|
- public static void SetMaxThreads(int maxThreads)
|
|
|
+ public static void InitThreadPool(int maxThreads)
|
|
|
{
|
|
|
+ if (maxThreads < 2)
|
|
|
+ throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
|
|
|
+
|
|
|
if (m_ThreadPool != null)
|
|
|
return;
|
|
|
|
|
@@ -1328,9 +1332,7 @@ namespace OpenSim.Framework
|
|
|
startInfo.IdleTimeout = 2000; // 2 seconds
|
|
|
startInfo.MaxWorkerThreads = maxThreads;
|
|
|
startInfo.MinWorkerThreads = 2;
|
|
|
- startInfo.StackSize = 524288;
|
|
|
startInfo.ThreadPriority = ThreadPriority.Normal;
|
|
|
-
|
|
|
startInfo.StartSuspended = false;
|
|
|
|
|
|
m_ThreadPool = new SmartThreadPool(startInfo);
|