aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs12
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index d09bd6d..167e34d 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -69,8 +69,6 @@ namespace OpenSim.Framework
69 /// </summary> 69 /// </summary>
70 public class Util 70 public class Util
71 { 71 {
72 private static SmartThreadPool m_ThreadPool = null;
73
74 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 72 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
75 73
76 private static uint nextXferID = 5000; 74 private static uint nextXferID = 5000;
@@ -79,6 +77,9 @@ namespace OpenSim.Framework
79 private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]"; 77 private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
80 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; 78 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
81 private static object XferLock = new object(); 79 private static object XferLock = new object();
80 /// <summary>Thread pool used for Util.FireAndForget if
81 /// FireAndForgetMethod.SmartThreadPool is used</summary>
82 private static SmartThreadPool m_ThreadPool;
82 83
83 // 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. 84 // 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.
84 private static readonly DateTime unixEpoch = 85 private static readonly DateTime unixEpoch =
@@ -1319,8 +1320,11 @@ namespace OpenSim.Framework
1319 FireAndForget(callback, null); 1320 FireAndForget(callback, null);
1320 } 1321 }
1321 1322
1322 public static void SetMaxThreads(int maxThreads) 1323 public static void InitThreadPool(int maxThreads)
1323 { 1324 {
1325 if (maxThreads < 2)
1326 throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2");
1327
1324 if (m_ThreadPool != null) 1328 if (m_ThreadPool != null)
1325 return; 1329 return;
1326 1330
@@ -1328,9 +1332,7 @@ namespace OpenSim.Framework
1328 startInfo.IdleTimeout = 2000; // 2 seconds 1332 startInfo.IdleTimeout = 2000; // 2 seconds
1329 startInfo.MaxWorkerThreads = maxThreads; 1333 startInfo.MaxWorkerThreads = maxThreads;
1330 startInfo.MinWorkerThreads = 2; 1334 startInfo.MinWorkerThreads = 2;
1331 startInfo.StackSize = 524288;
1332 startInfo.ThreadPriority = ThreadPriority.Normal; 1335 startInfo.ThreadPriority = ThreadPriority.Normal;
1333
1334 startInfo.StartSuspended = false; 1336 startInfo.StartSuspended = false;
1335 1337
1336 m_ThreadPool = new SmartThreadPool(startInfo); 1338 m_ThreadPool = new SmartThreadPool(startInfo);