diff options
author | Melanie | 2013-07-24 03:50:09 +0100 |
---|---|---|
committer | Melanie | 2013-07-24 03:50:09 +0100 |
commit | a7eb1b5b855b3caa6c4622789ef1377830e2f435 (patch) | |
tree | 2bd58bcd2bd9b37adeb746f4b399b1d98539d1cf /OpenSim/Framework/Util.cs | |
parent | Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into ... (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.zip opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.gz opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.bz2 opensim-SC-a7eb1b5b855b3caa6c4622789ef1377830e2f435.tar.xz |
Merge branch 'master' into careminster
Conflicts:
OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs
OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs
OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 6c7af12..19d40db 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1791,10 +1791,12 @@ namespace OpenSim.Framework | |||
1791 | FireAndForget(callback, null); | 1791 | FireAndForget(callback, null); |
1792 | } | 1792 | } |
1793 | 1793 | ||
1794 | public static void InitThreadPool(int maxThreads) | 1794 | public static void InitThreadPool(int minThreads, int maxThreads) |
1795 | { | 1795 | { |
1796 | if (maxThreads < 2) | 1796 | if (maxThreads < 2) |
1797 | throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2"); | 1797 | throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2"); |
1798 | if (minThreads > maxThreads || minThreads < 2) | ||
1799 | throw new ArgumentOutOfRangeException("minThreads", "minThreads must be greater than 2 and less than or equal to maxThreads"); | ||
1798 | if (m_ThreadPool != null) | 1800 | if (m_ThreadPool != null) |
1799 | throw new InvalidOperationException("SmartThreadPool is already initialized"); | 1801 | throw new InvalidOperationException("SmartThreadPool is already initialized"); |
1800 | 1802 | ||
@@ -1802,7 +1804,7 @@ namespace OpenSim.Framework | |||
1802 | startInfo.ThreadPoolName = "Util"; | 1804 | startInfo.ThreadPoolName = "Util"; |
1803 | startInfo.IdleTimeout = 2000; | 1805 | startInfo.IdleTimeout = 2000; |
1804 | startInfo.MaxWorkerThreads = maxThreads; | 1806 | startInfo.MaxWorkerThreads = maxThreads; |
1805 | startInfo.MinWorkerThreads = 2; | 1807 | startInfo.MinWorkerThreads = minThreads; |
1806 | 1808 | ||
1807 | m_ThreadPool = new SmartThreadPool(startInfo); | 1809 | m_ThreadPool = new SmartThreadPool(startInfo); |
1808 | } | 1810 | } |
@@ -1877,7 +1879,7 @@ namespace OpenSim.Framework | |||
1877 | break; | 1879 | break; |
1878 | case FireAndForgetMethod.SmartThreadPool: | 1880 | case FireAndForgetMethod.SmartThreadPool: |
1879 | if (m_ThreadPool == null) | 1881 | if (m_ThreadPool == null) |
1880 | InitThreadPool(15); | 1882 | InitThreadPool(2, 15); |
1881 | m_ThreadPool.QueueWorkItem((cb, o) => cb(o), realCallback, obj); | 1883 | m_ThreadPool.QueueWorkItem((cb, o) => cb(o), realCallback, obj); |
1882 | break; | 1884 | break; |
1883 | case FireAndForgetMethod.Thread: | 1885 | case FireAndForgetMethod.Thread: |
@@ -2265,7 +2267,7 @@ namespace OpenSim.Framework | |||
2265 | { | 2267 | { |
2266 | lock (m_syncRoot) | 2268 | lock (m_syncRoot) |
2267 | { | 2269 | { |
2268 | m_lowQueue.Enqueue(data); | 2270 | q.Enqueue(data); |
2269 | m_s.WaitOne(0); | 2271 | m_s.WaitOne(0); |
2270 | m_s.Release(); | 2272 | m_s.Release(); |
2271 | } | 2273 | } |
@@ -2305,7 +2307,7 @@ namespace OpenSim.Framework | |||
2305 | { | 2307 | { |
2306 | if (m_highQueue.Count > 0) | 2308 | if (m_highQueue.Count > 0) |
2307 | res = m_highQueue.Dequeue(); | 2309 | res = m_highQueue.Dequeue(); |
2308 | else | 2310 | else if (m_lowQueue.Count > 0) |
2309 | res = m_lowQueue.Dequeue(); | 2311 | res = m_lowQueue.Dequeue(); |
2310 | 2312 | ||
2311 | if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) | 2313 | if (m_highQueue.Count == 0 && m_lowQueue.Count == 0) |