From e131e73652cf6ed2407e41c7d83dc67f49ca23ee Mon Sep 17 00:00:00 2001
From: Oren Hurvitz
Date: Wed, 29 Jan 2014 16:14:27 +0200
Subject: 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
---
OpenSim/Framework/Util.cs | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
(limited to 'OpenSim/Framework/Util.cs')
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
#endregion FireAndForget Threading Pattern
///
+ /// Run the callback on a different thread, outside the thread pool. This is used for tasks
+ /// that may take a long time.
+ ///
+ public static void RunThreadNoTimeout(WaitCallback callback, string name, object obj)
+ {
+ Thread t = new Thread(delegate()
+ {
+ try
+ {
+ Culture.SetCurrentCulture();
+ callback(obj);
+ }
+ catch (Exception e)
+ {
+ m_log.Error("Exception in thread " + name, e);
+ }
+ });
+
+ t.Name = name;
+ t.Start();
+ }
+
+ ///
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
/// for the callers.
--
cgit v1.1