aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/UuidGatherer.cs84
1 files changed, 44 insertions, 40 deletions
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
57 /// Asset cache used for gathering assets 57 /// Asset cache used for gathering assets
58 /// </summary> 58 /// </summary>
59 protected IAssetService m_assetCache; 59 protected IAssetService m_assetCache;
60
61 /// <summary>
62 /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
63 /// asset was found by the asset service.
64 /// </summary>
65 private AssetBase m_requestedObjectAsset;
66 60
67 /// <summary> 61// /// <summary>
68 /// Signal whether we are currently waiting for the asset service to deliver an asset. 62// /// Used as a temporary store of an asset which represents an object. This can be a null if no appropriate
69 /// </summary> 63// /// asset was found by the asset service.
70 private bool m_waitingForObjectAsset; 64// /// </summary>
65// private AssetBase m_requestedObjectAsset;
66//
67// /// <summary>
68// /// Signal whether we are currently waiting for the asset service to deliver an asset.
69// /// </summary>
70// private bool m_waitingForObjectAsset;
71 71
72 public UuidGatherer(IAssetService assetCache) 72 public UuidGatherer(IAssetService assetCache)
73 { 73 {
@@ -195,18 +195,18 @@ namespace OpenSim.Region.Framework.Scenes
195 } 195 }
196 } 196 }
197 197
198 /// <summary> 198// /// <summary>
199 /// The callback made when we request the asset for an object from the asset service. 199// /// The callback made when we request the asset for an object from the asset service.
200 /// </summary> 200// /// </summary>
201 private void AssetReceived(string id, Object sender, AssetBase asset) 201// private void AssetReceived(string id, Object sender, AssetBase asset)
202 { 202// {
203 lock (this) 203// lock (this)
204 { 204// {
205 m_requestedObjectAsset = asset; 205// m_requestedObjectAsset = asset;
206 m_waitingForObjectAsset = false; 206// m_waitingForObjectAsset = false;
207 Monitor.Pulse(this); 207// Monitor.Pulse(this);
208 } 208// }
209 } 209// }
210 210
211 /// <summary> 211 /// <summary>
212 /// Get an asset synchronously, potentially using an asynchronous callback. If the 212 /// Get an asset synchronously, potentially using an asynchronous callback. If the
@@ -216,25 +216,29 @@ namespace OpenSim.Region.Framework.Scenes
216 /// <returns></returns> 216 /// <returns></returns>
217 protected virtual AssetBase GetAsset(UUID uuid) 217 protected virtual AssetBase GetAsset(UUID uuid)
218 { 218 {
219 m_waitingForObjectAsset = true; 219 return m_assetCache.Get(uuid.ToString());
220 m_assetCache.Get(uuid.ToString(), this, AssetReceived);
221
222 // The asset cache callback can either
223 //
224 // 1. Complete on the same thread (if the asset is already in the cache) or
225 // 2. Come in via a different thread (if we need to go fetch it).
226 //
227 // The code below handles both these alternatives.
228 lock (this)
229 {
230 if (m_waitingForObjectAsset)
231 {
232 Monitor.Wait(this);
233 m_waitingForObjectAsset = false;
234 }
235 }
236 220
237 return m_requestedObjectAsset; 221 // XXX: Switching to do this synchronously where the call was async before but we always waited for it
222 // to complete anyway!
223// m_waitingForObjectAsset = true;
224// m_assetCache.Get(uuid.ToString(), this, AssetReceived);
225//
226// // The asset cache callback can either
227// //
228// // 1. Complete on the same thread (if the asset is already in the cache) or
229// // 2. Come in via a different thread (if we need to go fetch it).
230// //
231// // The code below handles both these alternatives.
232// lock (this)
233// {
234// if (m_waitingForObjectAsset)
235// {
236// Monitor.Wait(this);
237// m_waitingForObjectAsset = false;
238// }
239// }
240//
241// return m_requestedObjectAsset;
238 } 242 }
239 243
240 /// <summary> 244 /// <summary>