public ReactorThreadInvokerQueue()
        {
            _queue = new ReactorQueue<QueueDelegate>(256);

            _blockingInvoker = new BlockingReactorThreadInvoker(this);
            _eventInvoker = new EventReactorThreadInvoker(this);
        }
예제 #2
0
        public void Open(IServiceHost host)
        {
            _queue = new ReactorQueue<int>(_capacity);
            _finishedEvent = new ManualResetEvent(false);
            _isFinished = false;
            _dequeuedObjects = new List<int>();

            _queue.StartDequeuingToCallback(host.Reactor, DequeueCallback);
        }
예제 #3
0
        public void Close(IServiceHost host)
        {
            _queue.StopDequeuingToCallback();

            if (!_isFinished) _finishedEvent.Set();

            _finishedEvent.Close();

            _queue = null;
            _finishedEvent = null;
            _isFinished = true;
            _dequeuedObjects = null;
        }
예제 #4
0
        void DequeueCallback(ReactorQueue<int> queue, int item)
        {
            _dequeuedObjects.Add(item);

            if (!_isFinished && _predicate(_dequeuedObjects))
            {
                _isFinished = true;

                _finishedEvent.Set();
            }
        }
 void InvokeDequeued(ReactorQueue<QueueDelegate> queue, QueueDelegate item)
 {
     item.Invoke();
 }