Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        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);
            }
        }