AcquireLock() public static méthode

Acquires the lock on the specified lockValue.
public static AcquireLock ( int &lockValue ) : void
lockValue int [in,out] The lock value.
Résultat void
Exemple #1
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);
            }
        }
Exemple #2
0
 /// <summary>Acquires the lock on the shared cache.</summary>
 public void AcquireLock()
 {
     SharedLock.AcquireLock(ref LockValue);
 }