From bceef401fa9f7b9d56c5d1173ca5204aead0a57c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 21 Sep 2012 01:36:23 +0100
Subject: Simplify UuidGatherer by performing asset fetch synchronously rather
than using the async call but waiting for completion anyway!
---
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 84 +++++++++++++------------
1 file changed, 44 insertions(+), 40 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index efb68a2..af99090 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -57,17 +57,17 @@ namespace OpenSim.Region.Framework.Scenes
/// Asset cache used for gathering assets
///
protected IAssetService m_assetCache;
-
- ///
- /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
- /// asset was found by the asset service.
- ///
- private AssetBase m_requestedObjectAsset;
- ///
- /// Signal whether we are currently waiting for the asset service to deliver an asset.
- ///
- private bool m_waitingForObjectAsset;
+// ///
+// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
+// /// asset was found by the asset service.
+// ///
+// private AssetBase m_requestedObjectAsset;
+//
+// ///
+// /// Signal whether we are currently waiting for the asset service to deliver an asset.
+// ///
+// private bool m_waitingForObjectAsset;
public UuidGatherer(IAssetService assetCache)
{
@@ -195,18 +195,18 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- ///
- /// The callback made when we request the asset for an object from the asset service.
- ///
- private void AssetReceived(string id, Object sender, AssetBase asset)
- {
- lock (this)
- {
- m_requestedObjectAsset = asset;
- m_waitingForObjectAsset = false;
- Monitor.Pulse(this);
- }
- }
+// ///
+// /// The callback made when we request the asset for an object from the asset service.
+// ///
+// private void AssetReceived(string id, Object sender, AssetBase asset)
+// {
+// lock (this)
+// {
+// m_requestedObjectAsset = asset;
+// m_waitingForObjectAsset = false;
+// Monitor.Pulse(this);
+// }
+// }
///
/// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -216,25 +216,29 @@ namespace OpenSim.Region.Framework.Scenes
///
protected virtual AssetBase GetAsset(UUID uuid)
{
- m_waitingForObjectAsset = true;
- m_assetCache.Get(uuid.ToString(), this, AssetReceived);
-
- // The asset cache callback can either
- //
- // 1. Complete on the same thread (if the asset is already in the cache) or
- // 2. Come in via a different thread (if we need to go fetch it).
- //
- // The code below handles both these alternatives.
- lock (this)
- {
- if (m_waitingForObjectAsset)
- {
- Monitor.Wait(this);
- m_waitingForObjectAsset = false;
- }
- }
+ return m_assetCache.Get(uuid.ToString());
- return m_requestedObjectAsset;
+ // XXX: Switching to do this synchronously where the call was async before but we always waited for it
+ // to complete anyway!
+// m_waitingForObjectAsset = true;
+// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
+//
+// // The asset cache callback can either
+// //
+// // 1. Complete on the same thread (if the asset is already in the cache) or
+// // 2. Come in via a different thread (if we need to go fetch it).
+// //
+// // The code below handles both these alternatives.
+// lock (this)
+// {
+// if (m_waitingForObjectAsset)
+// {
+// Monitor.Wait(this);
+// m_waitingForObjectAsset = false;
+// }
+// }
+//
+// return m_requestedObjectAsset;
}
///
--
cgit v1.1