public override void Send(SendOrPostCallback d, object state)
        {
            SendOrPostCallbackItem item = new SendOrPostCallbackItem(d, state, ExecutionType.Send);

            _queue.Enqueue(item);

            item.ExecutionCompleteWaitHandle.WaitOne();

            if (item.ExecuteWithException)
            {
                throw item.Exception;
            }
        }
コード例 #2
0
        private void Run()
        {
            while (true)
            {
                bool stop = _manualResetEvent.WaitOne(0);
                if (stop)
                {
                    break;
                }

                SendOrPostCallbackItem workItem = _queueConsumer.Dequeque();
                workItem?.Execute();
            }
        }
        public override void Post(SendOrPostCallback d, object state)
        {
            SendOrPostCallbackItem item = new SendOrPostCallbackItem(d, state, ExecutionType.Post);

            _queue.Enqueue(item);
        }