aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorOren Hurvitz2014-01-29 16:14:27 +0200
committerOren Hurvitz2014-03-25 08:01:55 +0100
commite131e73652cf6ed2407e41c7d83dc67f49ca23ee (patch)
treee0d8573e47c8edd7f2effca8d4177bc57bd10a26 /OpenSim/Framework
parentChanged LogThreadPool to have 4 logging levels. Added console command "debug ... (diff)
downloadopensim-SC-e131e73652cf6ed2407e41c7d83dc67f49ca23ee.zip
opensim-SC-e131e73652cf6ed2407e41c7d83dc67f49ca23ee.tar.gz
opensim-SC-e131e73652cf6ed2407e41c7d83dc67f49ca23ee.tar.bz2
opensim-SC-e131e73652cf6ed2407e41c7d83dc67f49ca23ee.tar.xz
Run slow operations in a separate thread, instead of using FireAndForget (which has a 1-minute timeout)
Resolves http://opensimulator.org/mantis/view.php?id=6945
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Util.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index b39dc5f..c9930fb 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -2320,6 +2320,29 @@ namespace OpenSim.Framework
2320 #endregion FireAndForget Threading Pattern 2320 #endregion FireAndForget Threading Pattern
2321 2321
2322 /// <summary> 2322 /// <summary>
2323 /// Run the callback on a different thread, outside the thread pool. This is used for tasks
2324 /// that may take a long time.
2325 /// </summary>
2326 public static void RunThreadNoTimeout(WaitCallback callback, string name, object obj)
2327 {
2328 Thread t = new Thread(delegate()
2329 {
2330 try
2331 {
2332 Culture.SetCurrentCulture();
2333 callback(obj);
2334 }
2335 catch (Exception e)
2336 {
2337 m_log.Error("Exception in thread " + name, e);
2338 }
2339 });
2340
2341 t.Name = name;
2342 t.Start();
2343 }
2344
2345 /// <summary>
2323 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive 2346 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
2324 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap 2347 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
2325 /// for the callers. 2348 /// for the callers.