/// <summary>Releases all locks.</summary> /// <returns>true if it succeeds, false if it fails.</returns> public static bool ReleaseLocks() { EvalManager.CacheDelegate.Buckets.ToList().ForEach(x => x.ReleaseLock()); EvalManager.CacheItem.Buckets.ToList().ForEach(x => x.ReleaseLock()); SharedLock.ReleaseLock(ref EvalManager.SharedLock.ExpireCacheLock); return(true); }
/// <summary>Gets the next counter.</summary> /// <returns>The next counter.</returns> public int GetNextCountAndAddParallel() { try { SharedLock.AcquireLock(ref EvalManager.SharedLock.CacheItemLock); Counter++; if (Counter == 0) { Counter++; } return(Counter); } finally { SharedLock.ReleaseLock(ref EvalManager.SharedLock.CacheItemLock); } }
/// <summary>Releases the lock on the shared cache.</summary> public void ReleaseLock() { SharedLock.ReleaseLock(ref LockValue); }