You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.2 KiB
43 lines
1.2 KiB
11 months ago
|
#if !BESTHTTP_DISABLE_CACHING
|
||
|
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
|
||
|
namespace BestHTTP.Caching
|
||
|
{
|
||
|
//static class HTTPCacheFileLock
|
||
|
//{
|
||
|
// private static Dictionary<Uri, object> FileLocks = new Dictionary<Uri, object>();
|
||
|
// //private static object SyncRoot = new object();
|
||
|
// private static System.Threading.ReaderWriterLockSlim rwLock = new System.Threading.ReaderWriterLockSlim(System.Threading.LockRecursionPolicy.NoRecursion);
|
||
|
//
|
||
|
// internal static object Acquire(Uri uri)
|
||
|
// {
|
||
|
// rwLock.EnterUpgradeableReadLock();
|
||
|
// try
|
||
|
// {
|
||
|
// object fileLock;
|
||
|
// if (!FileLocks.TryGetValue(uri, out fileLock))
|
||
|
// {
|
||
|
// rwLock.EnterWriteLock();
|
||
|
// try
|
||
|
// {
|
||
|
// FileLocks.Add(uri, fileLock = new object());
|
||
|
// }
|
||
|
// finally
|
||
|
// {
|
||
|
// rwLock.ExitWriteLock();
|
||
|
// }
|
||
|
// }
|
||
|
//
|
||
|
// return fileLock;
|
||
|
// }
|
||
|
// finally
|
||
|
// {
|
||
|
// rwLock.ExitUpgradeableReadLock();
|
||
|
// }
|
||
|
// }
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
#endif
|