Пример #1
0
        private List <Action> DequeueAll()
        {
            bool lockTaken = false;

            try
            {
                _lock.Enter(ref lockTaken);
                if (_actions.Count == 0)
                {
                    return(Queue.Empty);
                }

                Lists.Swap(ref _actions, ref _toPass);
                _actions.Clear();
                return(_toPass);
            }
            finally
            {
                if (lockTaken)
                {
                    _lock.Exit();
                }
            }
        }