private static void Unlock(string filename) { lobj o = null; if (_locks.TryGetValue(filename.ToLower(), out o)) { o.count--; if (o.count == 0) { _locks.TryRemove(filename.ToLower(), out lobj removedObject); } } }
private static lobj GetLock(string filename) { lobj o = null; if (_locks.TryGetValue(filename.ToLower(), out o)) { o.count++; return(o); } else { o = new lobj(); _locks.TryAdd(filename.ToLower(), o); o.count++; return(o); } }