aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorOren Hurvitz2014-03-25 10:04:52 +0200
committerOren Hurvitz2014-03-25 10:04:52 +0200
commit4289b7114198ea8dfb5b5d5134ada1e5582528d9 (patch)
tree33e99d7f339d2aecc861c8364e3a41226507cf59 /OpenSim/Framework/Util.cs
parentRun slow operations in a separate thread, instead of using FireAndForget (whi... (diff)
downloadopensim-SC-4289b7114198ea8dfb5b5d5134ada1e5582528d9.zip
opensim-SC-4289b7114198ea8dfb5b5d5134ada1e5582528d9.tar.gz
opensim-SC-4289b7114198ea8dfb5b5d5134ada1e5582528d9.tar.bz2
opensim-SC-4289b7114198ea8dfb5b5d5134ada1e5582528d9.tar.xz
Fixed unit tests due to changes in the threadpool
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs27
1 files changed, 19 insertions, 8 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index c9930fb..ae720f1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2081,15 +2081,19 @@ namespace OpenSim.Framework
2081 try 2081 try
2082 { 2082 {
2083 long numRunning = numRunningThreadFuncs; 2083 long numRunning = numRunningThreadFuncs;
2084 if ((threadFuncOverloadMode == 0) && (numRunning >= m_ThreadPool.MaxThreads)) 2084
2085 { 2085 if (m_ThreadPool != null)
2086 if (Interlocked.CompareExchange(ref threadFuncOverloadMode, 1, 0) == 0)
2087 m_log.DebugFormat("Threadfunc: enable overload mode (Queued {0}, Running {1})", numQueued, numRunning);
2088 }
2089 else if ((threadFuncOverloadMode == 1) && (numRunning <= (m_ThreadPool.MaxThreads*2)/3))
2090 { 2086 {
2091 if (Interlocked.CompareExchange(ref threadFuncOverloadMode, 0, 1) == 1) 2087 if ((threadFuncOverloadMode == 0) && (numRunning >= m_ThreadPool.MaxThreads))
2092 m_log.DebugFormat("Threadfunc: disable overload mode (Queued {0}, Running {1})", numQueued, numRunning); 2088 {
2089 if (Interlocked.CompareExchange(ref threadFuncOverloadMode, 1, 0) == 0)
2090 m_log.DebugFormat("Threadfunc: enable overload mode (Queued {0}, Running {1})", numQueued, numRunning);
2091 }
2092 else if ((threadFuncOverloadMode == 1) && (numRunning <= (m_ThreadPool.MaxThreads * 2) / 3))
2093 {
2094 if (Interlocked.CompareExchange(ref threadFuncOverloadMode, 0, 1) == 1)
2095 m_log.DebugFormat("Threadfunc: disable overload mode (Queued {0}, Running {1})", numQueued, numRunning);
2096 }
2093 } 2097 }
2094 2098
2095 if (loggingEnabled || (threadFuncOverloadMode == 1)) 2099 if (loggingEnabled || (threadFuncOverloadMode == 1))
@@ -2325,6 +2329,13 @@ namespace OpenSim.Framework
2325 /// </summary> 2329 /// </summary>
2326 public static void RunThreadNoTimeout(WaitCallback callback, string name, object obj) 2330 public static void RunThreadNoTimeout(WaitCallback callback, string name, object obj)
2327 { 2331 {
2332 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
2333 {
2334 Culture.SetCurrentCulture();
2335 callback(obj);
2336 return;
2337 }
2338
2328 Thread t = new Thread(delegate() 2339 Thread t = new Thread(delegate()
2329 { 2340 {
2330 try 2341 try