Exemplo n.º 1
0
 static EvalManager()
 {
     // ENSURE to create lock first
     SharedLock = new SharedLock();
     Configuration = new EvalContext();
     SQLNET.LoadConfiguration();
 }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
 /// <summary>Acquires the lock on the shared cache.</summary>
 public void AcquireLock()
 {
     SharedLock.AcquireLock(ref LockValue);
 }
Exemplo n.º 5
0
 /// <summary>Releases the lock on the shared cache.</summary>
 public void ReleaseLock()
 {
     SharedLock.ReleaseLock(ref LockValue);
 }