Example #1
0
        private List <Action> TryDequeue()
        {
            if (_actions.Count > 0)
            {
                Lists.Swap(ref _actions, ref _toPass);
                _actions.Clear();
                return(_toPass);
            }

            return(null);
        }
Example #2
0
 private List <Action> DequeueAll()
 {
     Wait();
     lock (_syncRoot)
     {
         if (Actions.Count == 0)
         {
             return(Queue.Empty);
         }
         Lists.Swap(ref Actions, ref ToPass);
         Actions.Clear();
         return(ToPass);
     }
 }
Example #3
0
        public List <Action> Drain()
        {
            lock (_lock)
            {
                if (ReadyToDequeue())
                {
                    Lists.Swap(ref _actions, ref _toPass);
                    _actions.Clear();
                    return(_toPass);
                }

                return(null);
            }
        }
Example #4
0
 private List <Action> ClearActions()
 {
     lock (_lock)
     {
         if (_queue.Count == 0)
         {
             _flushPending = false;
             return(Queue.Empty);
         }
         Lists.Swap(ref _queue, ref _toPass);
         _queue.Clear();
         return(_toPass);
     }
 }
Example #5
0
        public List <Action> Drain()
        {
            lock (_lock)
            {
                if (ReadyToDequeue())
                {
                    Lists.Swap(ref _actions, ref _toPass);
                    _actions.Clear();
                    Monitor.PulseAll(_lock);
                    return(_toPass);
                }

                return(Queue.Empty);
            }
        }
Example #6
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();
                }
            }
        }