diff options
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r-- | OpenSim/Framework/Util.cs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 38729c6..d5ae3b7 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -44,6 +44,7 @@ using System.Xml; | |||
44 | using log4net; | 44 | using log4net; |
45 | using Nini.Config; | 45 | using Nini.Config; |
46 | using Nwc.XmlRpc; | 46 | using Nwc.XmlRpc; |
47 | using BclExtras; | ||
47 | using OpenMetaverse; | 48 | using OpenMetaverse; |
48 | using OpenMetaverse.StructuredData; | 49 | using OpenMetaverse.StructuredData; |
49 | 50 | ||
@@ -1269,17 +1270,37 @@ namespace OpenSim.Framework | |||
1269 | 1270 | ||
1270 | #region FireAndForget Threading Pattern | 1271 | #region FireAndForget Threading Pattern |
1271 | 1272 | ||
1273 | /// <summary> | ||
1274 | /// Created to work around a limitation in Mono with nested delegates | ||
1275 | /// </summary> | ||
1276 | /*private class FireAndForgetWrapper | ||
1277 | { | ||
1278 | public void FireAndForget(System.Threading.WaitCallback callback) | ||
1279 | { | ||
1280 | callback.BeginInvoke(null, EndFireAndForget, callback); | ||
1281 | } | ||
1282 | |||
1283 | public void FireAndForget(System.Threading.WaitCallback callback, object obj) | ||
1284 | { | ||
1285 | callback.BeginInvoke(obj, EndFireAndForget, callback); | ||
1286 | } | ||
1287 | }*/ | ||
1288 | |||
1272 | public static void FireAndForget(System.Threading.WaitCallback callback) | 1289 | public static void FireAndForget(System.Threading.WaitCallback callback) |
1273 | { | 1290 | { |
1274 | callback.BeginInvoke(null, EndFireAndForget, callback); | 1291 | //FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); |
1292 | //wrapper.FireAndForget(callback); | ||
1293 | System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, null); | ||
1275 | } | 1294 | } |
1276 | 1295 | ||
1277 | public static void FireAndForget(System.Threading.WaitCallback callback, object obj) | 1296 | public static void FireAndForget(System.Threading.WaitCallback callback, object obj) |
1278 | { | 1297 | { |
1279 | callback.BeginInvoke(obj, EndFireAndForget, callback); | 1298 | //FireAndForgetWrapper wrapper = Singleton.GetInstance<FireAndForgetWrapper>(); |
1299 | //wrapper.FireAndForget(callback, obj); | ||
1300 | System.Threading.ThreadPool.UnsafeQueueUserWorkItem(callback, obj); | ||
1280 | } | 1301 | } |
1281 | 1302 | ||
1282 | private static void EndFireAndForget(IAsyncResult ar) | 1303 | /*private static void EndFireAndForget(IAsyncResult ar) |
1283 | { | 1304 | { |
1284 | System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState; | 1305 | System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState; |
1285 | 1306 | ||
@@ -1287,7 +1308,7 @@ namespace OpenSim.Framework | |||
1287 | catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); } | 1308 | catch (Exception ex) { m_log.Error("[UTIL]: Asynchronous method threw an exception: " + ex.Message, ex); } |
1288 | 1309 | ||
1289 | ar.AsyncWaitHandle.Close(); | 1310 | ar.AsyncWaitHandle.Close(); |
1290 | } | 1311 | }*/ |
1291 | 1312 | ||
1292 | #endregion FireAndForget Threading Pattern | 1313 | #endregion FireAndForget Threading Pattern |
1293 | } | 1314 | } |