Exemple #1
0
 /// <summary>
 /// 释放锁对象, 当锁的引用计数为0时, 从锁对象池移除
 /// </summary>
 /// <param name="key"></param>
 /// <param name="lockObj"></param>
 static void ReleaseLock(object key, LockObject lockObj)
 {
     lock (_lockPool)
     {
         lockObj.Decrement();
         //_Logger.DebugFormat("I am thread {0}:lock counter is {1}", Thread.CurrentThread.ManagedThreadId, lockObj.Counter);
         if (lockObj.Counter == 0)
         {
             _lockPool.Remove(key);
         }
     }
 }