From 69c8cc787f0bcecd617aeeff3d2776ba159d82ee Mon Sep 17 00:00:00 2001
From: BlueWall
Date: Thu, 13 Jan 2011 11:39:50 -0500
Subject: Make FireAndForgetWrapper a singleton class
Made FireAndForgetWrapper a singleton class to allow us to drop
dependancy on the BclExtras35 library. BclExtras is broken in
Mono 2.8.2 and we used the library in only one function.
---
OpenSim/Framework/Util.cs | 27 ++++++++++++++++++++++++---
bin/BclExtras35.dll | Bin 153600 -> 0 bytes
prebuild.xml | 2 --
3 files changed, 24 insertions(+), 5 deletions(-)
delete mode 100644 bin/BclExtras35.dll
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 8d1671a..d1d8736 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -46,7 +46,7 @@ using System.Threading;
using log4net;
using Nini.Config;
using Nwc.XmlRpc;
-using BclExtras;
+// using BclExtras;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
using Amib.Threading;
@@ -1375,8 +1375,29 @@ namespace OpenSim.Framework
///
/// Created to work around a limitation in Mono with nested delegates
///
- private class FireAndForgetWrapper
+ private sealed class FireAndForgetWrapper
{
+ private static volatile FireAndForgetWrapper instance;
+ private static object syncRoot = new Object();
+
+ public static FireAndForgetWrapper Instance {
+ get {
+
+ if (instance == null)
+ {
+ lock (syncRoot)
+ {
+ if (instance == null)
+ {
+ instance = new FireAndForgetWrapper();
+ }
+ }
+ }
+
+ return instance;
+ }
+ }
+
public void FireAndForget(System.Threading.WaitCallback callback)
{
callback.BeginInvoke(null, EndFireAndForget, callback);
@@ -1445,7 +1466,7 @@ namespace OpenSim.Framework
ThreadPool.QueueUserWorkItem(callback, obj);
break;
case FireAndForgetMethod.BeginInvoke:
- FireAndForgetWrapper wrapper = Singleton.GetInstance();
+ FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
wrapper.FireAndForget(callback, obj);
break;
case FireAndForgetMethod.SmartThreadPool:
diff --git a/bin/BclExtras35.dll b/bin/BclExtras35.dll
deleted file mode 100644
index 7a7480a..0000000
Binary files a/bin/BclExtras35.dll and /dev/null differ
diff --git a/prebuild.xml b/prebuild.xml
index 48bb2d3..854149b 100644
--- a/prebuild.xml
+++ b/prebuild.xml
@@ -158,7 +158,6 @@
-
@@ -1597,7 +1596,6 @@
-
--
cgit v1.1