mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 00:46:02 +08:00
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
This commit is contained in:
@@ -2319,6 +2319,29 @@ namespace OpenSim.Framework
|
||||
|
||||
#endregion FireAndForget Threading Pattern
|
||||
|
||||
/// <summary>
|
||||
/// Run the callback on a different thread, outside the thread pool. This is used for tasks
|
||||
/// that may take a long time.
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
||||
Reference in New Issue
Block a user