예제 #1
0
 public SuspenderToken Get()
 {
     lock (_lock)
     {
         SuspenderToken s = new SuspenderToken(this);
         _list.Add(s);
         return(s);
     }
 }
예제 #2
0
 public SuspenderToken Get()
 {
     _wlock.EnterWriteLock();
     try
     {
         SuspenderToken s = new SuspenderToken(this);
         _list.Add(s);
         return(s);
     }
     finally
     {
         _wlock.ExitWriteLock();
     }
 }
예제 #3
0
        public void Resume(SuspenderToken s)
        {
            lock (_lock)
            {
                _list.Remove(s);
                if (_list.Count > 0)
                {
                    return;
                }
            }

//            try
            {
                _action?.Invoke();
            }
//            catch (Exception)
            {
            }
        }
예제 #4
0
        public void Resume(SuspenderToken s)
        {
            _wlock.EnterWriteLock();
            try
            {
                _list.Remove(s);
                if (_list.Count > 0)
                {
                    return;
                }
            }
            finally
            {
                _wlock.ExitWriteLock();
            }

            //            try
            {
                _action?.Invoke();
            }
//            catch (Exception)
            {
            }
        }