internal static void DeleteEntity(Uri uri) { object obj = HTTPCacheFileLock.Acquire(uri); if (Monitor.TryEnter(obj, TimeSpan.FromSeconds(0.5))) { try { lock (Library) { HTTPCacheFileInfo value; bool flag = Library.TryGetValue(uri, out value); if (flag) { value.Delete(); } if (flag) { Library.Remove(uri); } } } finally { Monitor.Exit(obj); } } }
internal static bool DeleteEntity(Uri uri, bool removeFromLibrary = true) { object uriLocker = HTTPCacheFileLock.Acquire(uri); // To avoid a dead-lock we try acquire the lock on this uri only for a little time. // If we can't acquire it, its better to just return without risking a deadlock. if (Monitor.TryEnter(uriLocker, TimeSpan.FromSeconds(0.5f))) { try { lock (Library) { HTTPCacheFileInfo info; bool inStats = Library.TryGetValue(uri, out info); if (inStats) { info.Delete(); } if (inStats && removeFromLibrary) { Library.Remove(uri); } return(true); } } finally { Monitor.Exit(uriLocker); } } return(false); }
internal static bool DeleteEntity(Uri uri, bool removeFromLibrary = true) { object obj = HTTPCacheFileLock.Acquire(uri); object obj2 = obj; bool result; lock (obj2) { try { Dictionary <Uri, HTTPCacheFileInfo> obj3 = HTTPCacheService.Library; lock (obj3) { HTTPCacheFileInfo hTTPCacheFileInfo; bool flag = HTTPCacheService.Library.TryGetValue(uri, out hTTPCacheFileInfo); if (flag) { hTTPCacheFileInfo.Delete(); } if (flag && removeFromLibrary) { HTTPCacheService.Library.Remove(uri); } result = true; } } finally { } } return(result); }
internal static bool DeleteEntity(Uri uri, bool removeFromLibrary = true) { if (!IsSupported) { return(false); } object uriLocker = HTTPCacheFileLock.Acquire(uri); // Just use lock now: http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-6#post-1937033 // To avoid a dead-lock we try acquire the lock on this uri only for a little time. // If we can't acquire it, its better to just return without risking a deadlock. //if (Monitor.TryEnter(uriLocker, TimeSpan.FromSeconds(0.5f))) lock (uriLocker) { try { lock (Library) { HTTPCacheFileInfo info; bool inStats = Library.TryGetValue(uri, out info); if (inStats) { info.Delete(); } if (inStats && removeFromLibrary) { Library.Remove(uri); UsedIndexes.Remove(info.MappedNameIDX); } return(true); } } finally { //Monitor.Exit(uriLocker); } } //return false; }