aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Util.cs27
1 files changed, 24 insertions, 3 deletions
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;
46using log4net; 46using log4net;
47using Nini.Config; 47using Nini.Config;
48using Nwc.XmlRpc; 48using Nwc.XmlRpc;
49using BclExtras; 49// using BclExtras;
50using OpenMetaverse; 50using OpenMetaverse;
51using OpenMetaverse.StructuredData; 51using OpenMetaverse.StructuredData;
52using Amib.Threading; 52using Amib.Threading;
@@ -1375,8 +1375,29 @@ namespace OpenSim.Framework
1375 /// <summary> 1375 /// <summary>
1376 /// Created to work around a limitation in Mono with nested delegates 1376 /// Created to work around a limitation in Mono with nested delegates
1377 /// </summary> 1377 /// </summary>
1378 private class FireAndForgetWrapper 1378 private sealed class FireAndForgetWrapper
1379 { 1379 {
1380 private static volatile FireAndForgetWrapper instance;
1381 private static object syncRoot = new Object();
1382
1383 public static FireAndForgetWrapper Instance {
1384 get {
1385
1386 if (instance == null)
1387 {
1388 lock (syncRoot)
1389 {
1390 if (instance == null)
1391 {
1392 instance = new FireAndForgetWrapper();
1393 }
1394 }
1395 }
1396
1397 return instance;
1398 }
1399 }
1400
1380 public void FireAndForget(System.Threading.WaitCallback callback) 1401 public void FireAndForget(System.Threading.WaitCallback callback)
1381 { 1402 {
1382 callback.BeginInvoke(null, EndFireAndForget, callback); 1403 callback.BeginInvoke(null, EndFireAndForget, callback);
@@ -1445,7 +1466,7 @@ namespace OpenSim.Framework
1445 ThreadPool.QueueUserWorkItem(callback, obj); 1466 ThreadPool.QueueUserWorkItem(callback, obj);
1446 break; 1467 break;
1447 case FireAndForgetMethod.BeginInvoke: 1468 case FireAndForgetMethod.BeginInvoke:
1448 FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); 1469 FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
1449 wrapper.FireAndForget(callback, obj); 1470 wrapper.FireAndForget(callback, obj);
1450 break; 1471 break;
1451 case FireAndForgetMethod.SmartThreadPool: 1472 case FireAndForgetMethod.SmartThreadPool: