From 80a8a9c4a7c9f1f0351f70f944a69650e9eca930 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Fri, 16 Oct 2009 14:34:42 -0700
Subject: Converted FireAndForget methods to use a singleton pattern to attempt
to work around a Mono bug with nested delegates
---
OpenSim/Framework/Util.cs | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 38729c6..3203fc1 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -44,6 +44,7 @@ using System.Xml;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
+using BclExtras;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -1269,14 +1270,32 @@ namespace OpenSim.Framework
#region FireAndForget Threading Pattern
+ ///
+ /// Created to work around a limitation in Mono with nested delegates
+ ///
+ private class FireAndForgetWrapper
+ {
+ public void FireAndForget(System.Threading.WaitCallback callback)
+ {
+ callback.BeginInvoke(null, EndFireAndForget, callback);
+ }
+
+ public void FireAndForget(System.Threading.WaitCallback callback, object obj)
+ {
+ callback.BeginInvoke(obj, EndFireAndForget, callback);
+ }
+ }
+
public static void FireAndForget(System.Threading.WaitCallback callback)
{
- callback.BeginInvoke(null, EndFireAndForget, callback);
+ FireAndForgetWrapper wrapper = Singleton.GetInstance();
+ wrapper.FireAndForget(callback);
}
public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
{
- callback.BeginInvoke(obj, EndFireAndForget, callback);
+ FireAndForgetWrapper wrapper = Singleton.GetInstance();
+ wrapper.FireAndForget(callback, obj);
}
private static void EndFireAndForget(IAsyncResult ar)
--
cgit v1.1