aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorUbitUmarov2017-06-13 18:39:42 +0100
committerUbitUmarov2017-06-13 18:39:42 +0100
commit5ce15566acf41be0d07e67e858d22eb65177816a (patch)
tree7b1ccd75ad0c41f079eeaa925b3b4b964dd446ad /OpenSim
parent hope gc does remove a little dic and contents (diff)
downloadopensim-SC-5ce15566acf41be0d07e67e858d22eb65177816a.zip
opensim-SC-5ce15566acf41be0d07e67e858d22eb65177816a.tar.gz
opensim-SC-5ce15566acf41be0d07e67e858d22eb65177816a.tar.bz2
opensim-SC-5ce15566acf41be0d07e67e858d22eb65177816a.tar.xz
add option for Fireandforget not timeout (our access to main smartThreadPool)
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Monitoring/WorkManager.cs8
-rw-r--r--OpenSim/Framework/Util.cs10
2 files changed, 9 insertions, 9 deletions
diff --git a/OpenSim/Framework/Monitoring/WorkManager.cs b/OpenSim/Framework/Monitoring/WorkManager.cs
index 9d52f71..50f6731 100644
--- a/OpenSim/Framework/Monitoring/WorkManager.cs
+++ b/OpenSim/Framework/Monitoring/WorkManager.cs
@@ -182,9 +182,9 @@ namespace OpenSim.Framework.Monitoring
182 /// <param name="callback"></param> 182 /// <param name="callback"></param>
183 /// <param name="obj"></param> 183 /// <param name="obj"></param>
184 /// <param name="name">The name of the job. This is used in monitoring and debugging.</param> 184 /// <param name="name">The name of the job. This is used in monitoring and debugging.</param>
185 public static void RunInThreadPool(System.Threading.WaitCallback callback, object obj, string name) 185 public static void RunInThreadPool(System.Threading.WaitCallback callback, object obj, string name, bool timeout = true)
186 { 186 {
187 Util.FireAndForget(callback, obj, name); 187 Util.FireAndForget(callback, obj, name, timeout);
188 } 188 }
189 189
190 /// <summary> 190 /// <summary>
@@ -231,10 +231,8 @@ namespace OpenSim.Framework.Monitoring
231 JobEngine.QueueJob(name, () => callback(obj)); 231 JobEngine.QueueJob(name, () => callback(obj));
232 else if (canRunInThisThread) 232 else if (canRunInThisThread)
233 callback(obj); 233 callback(obj);
234 else if (mustNotTimeout)
235 RunInThread(callback, obj, name, log);
236 else 234 else
237 Util.FireAndForget(callback, obj, name); 235 Util.FireAndForget(callback, obj, name, !mustNotTimeout);
238 } 236 }
239 237
240 private static void HandleControlCommand(string module, string[] args) 238 private static void HandleControlCommand(string module, string[] args)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index f52a84c..9a1e348 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2492,8 +2492,9 @@ namespace OpenSim.Framework
2492 public bool Running { get; set; } 2492 public bool Running { get; set; }
2493 public bool Aborted { get; set; } 2493 public bool Aborted { get; set; }
2494 private int started; 2494 private int started;
2495 public bool DoTimeout;
2495 2496
2496 public ThreadInfo(long threadFuncNum, string context) 2497 public ThreadInfo(long threadFuncNum, string context, bool dotimeout = true)
2497 { 2498 {
2498 ThreadFuncNum = threadFuncNum; 2499 ThreadFuncNum = threadFuncNum;
2499 this.context = context; 2500 this.context = context;
@@ -2501,6 +2502,7 @@ namespace OpenSim.Framework
2501 Thread = null; 2502 Thread = null;
2502 Running = false; 2503 Running = false;
2503 Aborted = false; 2504 Aborted = false;
2505 DoTimeout = dotimeout;
2504 } 2506 }
2505 2507
2506 public void Started() 2508 public void Started()
@@ -2571,7 +2573,7 @@ namespace OpenSim.Framework
2571 foreach (KeyValuePair<long, ThreadInfo> entry in activeThreads) 2573 foreach (KeyValuePair<long, ThreadInfo> entry in activeThreads)
2572 { 2574 {
2573 ThreadInfo t = entry.Value; 2575 ThreadInfo t = entry.Value;
2574 if (t.Running && !t.Aborted && (t.Elapsed() >= THREAD_TIMEOUT)) 2576 if (t.DoTimeout && t.Running && !t.Aborted && (t.Elapsed() >= THREAD_TIMEOUT))
2575 { 2577 {
2576 m_log.WarnFormat("Timeout in threadfunc {0} ({1}) {2}", t.ThreadFuncNum, t.Thread.Name, t.GetStackTrace()); 2578 m_log.WarnFormat("Timeout in threadfunc {0} ({1}) {2}", t.ThreadFuncNum, t.Thread.Name, t.GetStackTrace());
2577 t.Abort(); 2579 t.Abort();
@@ -2612,7 +2614,7 @@ namespace OpenSim.Framework
2612 FireAndForget(callback, obj, null); 2614 FireAndForget(callback, obj, null);
2613 } 2615 }
2614 2616
2615 public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context) 2617 public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context, bool dotimeout = true)
2616 { 2618 {
2617 Interlocked.Increment(ref numTotalThreadFuncsCalled); 2619 Interlocked.Increment(ref numTotalThreadFuncsCalled);
2618 2620
@@ -2634,7 +2636,7 @@ namespace OpenSim.Framework
2634 bool loggingEnabled = LogThreadPool > 0; 2636 bool loggingEnabled = LogThreadPool > 0;
2635 2637
2636 long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum); 2638 long threadFuncNum = Interlocked.Increment(ref nextThreadFuncNum);
2637 ThreadInfo threadInfo = new ThreadInfo(threadFuncNum, context); 2639 ThreadInfo threadInfo = new ThreadInfo(threadFuncNum, context, dotimeout);
2638 2640
2639 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest) 2641 if (FireAndForgetMethod == FireAndForgetMethod.RegressionTest)
2640 { 2642 {