diff options
7 files changed, 34 insertions, 6 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index bbb0ae2..58344f3 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1169,5 +1169,27 @@ namespace OpenSim.Framework | |||
1169 | 1169 | ||
1170 | return found.ToArray(); | 1170 | return found.ToArray(); |
1171 | } | 1171 | } |
1172 | |||
1173 | #region FireAndForget Threading Pattern | ||
1174 | |||
1175 | public static void FireAndForget(System.Threading.WaitCallback callback) | ||
1176 | { | ||
1177 | callback.BeginInvoke(null, EndFireAndForget, callback); | ||
1178 | } | ||
1179 | |||
1180 | public static void FireAndForget(System.Threading.WaitCallback callback, object obj) | ||
1181 | { | ||
1182 | callback.BeginInvoke(obj, EndFireAndForget, callback); | ||
1183 | } | ||
1184 | |||
1185 | private static void EndFireAndForget(IAsyncResult ar) | ||
1186 | { | ||
1187 | System.Threading.WaitCallback callback = (System.Threading.WaitCallback)ar.AsyncState; | ||
1188 | |||
1189 | callback.EndInvoke(ar); | ||
1190 | ar.AsyncWaitHandle.Close(); | ||
1191 | } | ||
1192 | |||
1193 | #endregion FireAndForget Threading Pattern | ||
1172 | } | 1194 | } |
1173 | } | 1195 | } |
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs index 621e9d2..7b4e374 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/HGAssetBroker.cs | |||
@@ -272,7 +272,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
272 | 272 | ||
273 | if (asset != null) | 273 | if (asset != null) |
274 | { | 274 | { |
275 | handler.BeginInvoke(id, sender, asset, null, null); | 275 | Util.FireAndForget(delegate { handler(id, sender, asset); }); |
276 | return true; | 276 | return true; |
277 | } | 277 | } |
278 | 278 | ||
diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs index b13a116..fd3aaf4 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Asset/LocalAssetServiceConnector.cs | |||
@@ -211,7 +211,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
211 | 211 | ||
212 | if (asset != null) | 212 | if (asset != null) |
213 | { | 213 | { |
214 | handler.BeginInvoke(id, sender, asset, null, null); | 214 | Util.FireAndForget(delegate { handler(id, sender, asset); }); |
215 | return true; | 215 | return true; |
216 | } | 216 | } |
217 | 217 | ||
@@ -219,8 +219,8 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Asset | |||
219 | { | 219 | { |
220 | if ((a != null) && (m_Cache != null)) | 220 | if ((a != null) && (m_Cache != null)) |
221 | m_Cache.Cache(a); | 221 | m_Cache.Cache(a); |
222 | 222 | ||
223 | handler.BeginInvoke(assetID, s, a, null, null); | 223 | Util.FireAndForget(delegate { handler(assetID, s, a); }); |
224 | }); | 224 | }); |
225 | } | 225 | } |
226 | 226 | ||
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 55b100b..fddba86 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -457,6 +457,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
457 | 457 | ||
458 | void SendInventoryComplete(IAsyncResult iar) | 458 | void SendInventoryComplete(IAsyncResult iar) |
459 | { | 459 | { |
460 | SendInventoryDelegate d = (SendInventoryDelegate)iar.AsyncState; | ||
461 | d.EndInvoke(iar); | ||
460 | } | 462 | } |
461 | 463 | ||
462 | /// <summary> | 464 | /// <summary> |
@@ -622,6 +624,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
622 | 624 | ||
623 | private void PurgeFolderCompleted(IAsyncResult iar) | 625 | private void PurgeFolderCompleted(IAsyncResult iar) |
624 | { | 626 | { |
627 | PurgeFolderDelegate d = (PurgeFolderDelegate)iar.AsyncState; | ||
628 | d.EndInvoke(iar); | ||
625 | } | 629 | } |
626 | } | 630 | } |
627 | } | 631 | } |
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs index d9748d4..ffc8e4c 100644 --- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs | |||
@@ -177,7 +177,7 @@ namespace OpenSim.Services.Connectors | |||
177 | } | 177 | } |
178 | else | 178 | else |
179 | { | 179 | { |
180 | handler.BeginInvoke(id, sender, asset, null, null); | 180 | Util.FireAndForget(delegate { handler(id, sender, asset); }); |
181 | } | 181 | } |
182 | 182 | ||
183 | return true; | 183 | return true; |
diff --git a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs index a2261ba..cef678d 100644 --- a/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs +++ b/OpenSim/Services/Connectors/Inventory/InventoryServiceConnector.cs | |||
@@ -461,6 +461,8 @@ namespace OpenSim.Services.Connectors | |||
461 | 461 | ||
462 | private void MoveItemsCompleted(IAsyncResult iar) | 462 | private void MoveItemsCompleted(IAsyncResult iar) |
463 | { | 463 | { |
464 | MoveItemsDelegate d = (MoveItemsDelegate)iar.AsyncState; | ||
465 | d.EndInvoke(iar); | ||
464 | } | 466 | } |
465 | 467 | ||
466 | public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID) | 468 | public bool MoveItems(string userID, List<InventoryItemBase> items, UUID sessionID) |
diff --git a/OpenSim/Services/InventoryService/InventoryService.cs b/OpenSim/Services/InventoryService/InventoryService.cs index f04754b..b98e256 100644 --- a/OpenSim/Services/InventoryService/InventoryService.cs +++ b/OpenSim/Services/InventoryService/InventoryService.cs | |||
@@ -232,7 +232,7 @@ namespace OpenSim.Services.InventoryService | |||
232 | m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID); | 232 | m_log.WarnFormat("[INVENTORY SERVICE]: User {0} inventory not available", userID); |
233 | } | 233 | } |
234 | 234 | ||
235 | callback.BeginInvoke(folders, items, null, null); | 235 | Util.FireAndForget(delegate { callback(folders, items); }); |
236 | } | 236 | } |
237 | 237 | ||
238 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) | 238 | public InventoryCollection GetFolderContent(UUID userID, UUID folderID) |