diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/VersionInfo.cs | 2 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 26 |
2 files changed, 24 insertions, 4 deletions
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 9f98310..812abd1 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,7 +29,7 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.6.8"; | 32 | private const string VERSION_NUMBER = "0.6.8-mel_t"; |
33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; | 33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; |
34 | 34 | ||
35 | public enum Flavour | 35 | public enum Flavour |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 02f6d12..d09bd6d 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -41,12 +41,14 @@ using System.Security.Cryptography; | |||
41 | using System.Text; | 41 | using System.Text; |
42 | using System.Text.RegularExpressions; | 42 | using System.Text.RegularExpressions; |
43 | using System.Xml; | 43 | using System.Xml; |
44 | using System.Threading; | ||
44 | using log4net; | 45 | using log4net; |
45 | using Nini.Config; | 46 | using Nini.Config; |
46 | using Nwc.XmlRpc; | 47 | using Nwc.XmlRpc; |
47 | using BclExtras; | 48 | using BclExtras; |
48 | using OpenMetaverse; | 49 | using OpenMetaverse; |
49 | using OpenMetaverse.StructuredData; | 50 | using OpenMetaverse.StructuredData; |
51 | using Amib.Threading; | ||
50 | 52 | ||
51 | namespace OpenSim.Framework | 53 | namespace OpenSim.Framework |
52 | { | 54 | { |
@@ -67,6 +69,8 @@ namespace OpenSim.Framework | |||
67 | /// </summary> | 69 | /// </summary> |
68 | public class Util | 70 | public class Util |
69 | { | 71 | { |
72 | private static SmartThreadPool m_ThreadPool = null; | ||
73 | |||
70 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 74 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
71 | 75 | ||
72 | private static uint nextXferID = 5000; | 76 | private static uint nextXferID = 5000; |
@@ -83,7 +87,7 @@ namespace OpenSim.Framework | |||
83 | public static readonly Regex UUIDPattern | 87 | public static readonly Regex UUIDPattern |
84 | = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); | 88 | = new Regex("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"); |
85 | 89 | ||
86 | public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.UnsafeQueueUserWorkItem; | 90 | public static FireAndForgetMethod FireAndForgetMethod = FireAndForgetMethod.SmartThreadPool; |
87 | 91 | ||
88 | /// <summary> | 92 | /// <summary> |
89 | /// Linear interpolates B<->C using percent A | 93 | /// Linear interpolates B<->C using percent A |
@@ -1315,6 +1319,23 @@ namespace OpenSim.Framework | |||
1315 | FireAndForget(callback, null); | 1319 | FireAndForget(callback, null); |
1316 | } | 1320 | } |
1317 | 1321 | ||
1322 | public static void SetMaxThreads(int maxThreads) | ||
1323 | { | ||
1324 | if (m_ThreadPool != null) | ||
1325 | return; | ||
1326 | |||
1327 | STPStartInfo startInfo = new STPStartInfo(); | ||
1328 | startInfo.IdleTimeout = 2000; // 2 seconds | ||
1329 | startInfo.MaxWorkerThreads = maxThreads; | ||
1330 | startInfo.MinWorkerThreads = 2; | ||
1331 | startInfo.StackSize = 524288; | ||
1332 | startInfo.ThreadPriority = ThreadPriority.Normal; | ||
1333 | |||
1334 | startInfo.StartSuspended = false; | ||
1335 | |||
1336 | m_ThreadPool = new SmartThreadPool(startInfo); | ||
1337 | } | ||
1338 | |||
1318 | public static void FireAndForget(System.Threading.WaitCallback callback, object obj) | 1339 | public static void FireAndForget(System.Threading.WaitCallback callback, object obj) |
1319 | { | 1340 | { |
1320 | switch (FireAndForgetMethod) | 1341 | switch (FireAndForgetMethod) |
@@ -1330,8 +1351,7 @@ namespace OpenSim.Framework | |||
1330 | wrapper.FireAndForget(callback, obj); | 1351 | wrapper.FireAndForget(callback, obj); |
1331 | break; | 1352 | break; |
1332 | case FireAndForgetMethod.SmartThreadPool: | 1353 | case FireAndForgetMethod.SmartThreadPool: |
1333 | Amib.Threading.SmartThreadPool stp = Singleton.GetInstance<Amib.Threading.SmartThreadPool>(); | 1354 | m_ThreadPool.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj); |
1334 | stp.QueueWorkItem(delegate(object o) { callback(o); return null; }, obj); | ||
1335 | break; | 1355 | break; |
1336 | case FireAndForgetMethod.Thread: | 1356 | case FireAndForgetMethod.Thread: |
1337 | System.Threading.Thread thread = new System.Threading.Thread(delegate(object o) { callback(o); }); | 1357 | System.Threading.Thread thread = new System.Threading.Thread(delegate(object o) { callback(o); }); |