protected void OnSendException(SBPSendExceptionEventArgs e) { if (SendExeceptionEvent != null) { SendExeceptionEvent.Invoke(this, e); } }
private void InvokeThread() { SBPSendExceptionEventArgs sendException = null; SBPReadExceptionEventArgs readException = null; while (!_invokeThreadStop) { if (_sendExceptionQueue.Count > 0) { lock (_syncobject) sendException = _sendExceptionQueue.Dequeue(); } if (_readExceptionQueue.Count > 0) { lock (_syncobject) readException = _readExceptionQueue.Dequeue(); } if (sendException != null) { OnSendException(sendException); sendException = null; } if (readException != null) { OnReadException(readException); readException = null; } if (!InvokeThreadExecute() && readException == null && sendException == null) { Thread.Sleep(1); } } }