예제 #1
0
 public void Enqueue(ExecutionQueueItem item)
 {
     lock (_items) {
         _items.Add(item);
         _event.Set();
     }
 }
예제 #2
0
 public void Process(ExecutionQueueItem item)
 {
     if (Running)
     {
         // Remote side called us, we called back, and now they're calling back again.  Process this request synchronously so we don't hang
         _commandDispatcher(() => {
             item.Process();
         });
     }
     else
     {
         Enqueue(item);
         item.Wait();
     }
 }
예제 #3
0
        private void ExecutionThread()
        {
            while (!_shouldShutDown)
            {
                ExecutionQueueItem curItem = null;
                lock (_items) {
                    if (_items.Count > 0)
                    {
                        curItem = _items[0];
                        _items.RemoveAt(0);
                    }
                }

                if (curItem != null)
                {
                    try {
                        _running = true;
                        try {
                            _commandDispatcher(() => curItem.Process());
                        } finally {
                            _running = false;
                        }

                        while (_aborting)
                        {
                            // wait for abort thread to complete
                            ;
                        }
                    } catch (ThreadAbortException) {
                        Thread.ResetAbort();
                    }
                    curItem.Complete();
                }
                else
                {
                    _event.WaitOne();
                }
            }
        }
예제 #4
0
 public void Process(ExecutionQueueItem item)
 {
     if (Running) {
         // Remote side called us, we called back, and now they're calling back again.  Process this request synchronously so we don't hang
         _commandDispatcher(() => {
             item.Process();
         });
     } else {
         Enqueue(item);
         item.Wait();
     }
 }
예제 #5
0
 public void Enqueue(ExecutionQueueItem item)
 {
     lock (_items) {
         _items.Add(item);
         _event.Set();
     }
 }