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; } }
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); }