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.bulletsim
parent
705f4e1e4b
commit
b341bc0908
|
@ -46,7 +46,7 @@ using System.Threading;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
using Nwc.XmlRpc;
|
using Nwc.XmlRpc;
|
||||||
using BclExtras;
|
// using BclExtras;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using OpenMetaverse.StructuredData;
|
using OpenMetaverse.StructuredData;
|
||||||
using Amib.Threading;
|
using Amib.Threading;
|
||||||
|
@ -1375,8 +1375,29 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Created to work around a limitation in Mono with nested delegates
|
/// Created to work around a limitation in Mono with nested delegates
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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)
|
public void FireAndForget(System.Threading.WaitCallback callback)
|
||||||
{
|
{
|
||||||
callback.BeginInvoke(null, EndFireAndForget, callback);
|
callback.BeginInvoke(null, EndFireAndForget, callback);
|
||||||
|
@ -1445,7 +1466,7 @@ namespace OpenSim.Framework
|
||||||
ThreadPool.QueueUserWorkItem(callback, obj);
|
ThreadPool.QueueUserWorkItem(callback, obj);
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.BeginInvoke:
|
case FireAndForgetMethod.BeginInvoke:
|
||||||
FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>();
|
FireAndForgetWrapper wrapper = FireAndForgetWrapper.Instance;
|
||||||
wrapper.FireAndForget(callback, obj);
|
wrapper.FireAndForget(callback, obj);
|
||||||
break;
|
break;
|
||||||
case FireAndForgetMethod.SmartThreadPool:
|
case FireAndForgetMethod.SmartThreadPool:
|
||||||
|
|
Binary file not shown.
|
@ -158,7 +158,6 @@
|
||||||
<Reference name="System.Data"/>
|
<Reference name="System.Data"/>
|
||||||
<Reference name="System.Drawing"/>
|
<Reference name="System.Drawing"/>
|
||||||
<Reference name="System.Web"/>
|
<Reference name="System.Web"/>
|
||||||
<Reference name="BclExtras35" path="../../bin/"/>
|
|
||||||
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
<Reference name="OpenMetaverseTypes" path="../../bin/"/>
|
||||||
<Reference name="OpenMetaverse" path="../../bin/"/>
|
<Reference name="OpenMetaverse" path="../../bin/"/>
|
||||||
<Reference name="OpenMetaverse.StructuredData" path="../../bin/"/>
|
<Reference name="OpenMetaverse.StructuredData" path="../../bin/"/>
|
||||||
|
@ -1597,7 +1596,6 @@
|
||||||
<Reference name="OpenSim.Region.ClientStack"/>
|
<Reference name="OpenSim.Region.ClientStack"/>
|
||||||
<Reference name="OpenSim.Region.Physics.Manager"/>
|
<Reference name="OpenSim.Region.Physics.Manager"/>
|
||||||
<Reference name="OpenSim.Services.Interfaces"/>
|
<Reference name="OpenSim.Services.Interfaces"/>
|
||||||
<Reference name="BclExtras35" path="../../../../bin/"/>
|
|
||||||
<Reference name="XMLRPC" path="../../../../bin/"/>
|
<Reference name="XMLRPC" path="../../../../bin/"/>
|
||||||
<Reference name="Nini" path="../../../../bin/"/>
|
<Reference name="Nini" path="../../../../bin/"/>
|
||||||
<Reference name="log4net" path="../../../../bin/"/>
|
<Reference name="log4net" path="../../../../bin/"/>
|
||||||
|
|
Loading…
Reference in New Issue