Exemple #1
0
        public void Dispose()
        {
            _dequeuelock.Reset();
            ConsumerAction?.Invoke(_queue1);
            ConsumerAction?.Invoke(_queue2);

            _isexit = true;
        }
Exemple #2
0
        private async void BackgroundWorker_DoWork()
        {
            while (true)
            {
                var readQueue = this.GetDequeue();
                ConsumerAction?.Invoke(readQueue);

                if (ConsumerActionAsync != null)
                {
                    await ConsumerActionAsync(readQueue); //task
                }

                if (_millisecond > 0)
                {
                    await Task.Delay(_millisecond);
                }

                if (_isexit)
                {
                    return;
                }
            }
        }