示例#1
0
        public static TimedLock Lock(object o, int milliSeconds)
        {
            var timedLock = new TimedLock(o);

            if (!Monitor.TryEnter(o, milliSeconds))
            {
                throw new LockTimeoutException();
            }

            return(timedLock);
        }
示例#2
0
        public static TimedLock Lock(object o, int milliSeconds)
        {
            var timedLock = new TimedLock(o);

            if (!Monitor.TryEnter(o, milliSeconds))
            {
                throw new LockTimeoutException();
            }

            return timedLock;
        }