Esempio n. 1
0
 protected void OnReadException(SBPReadExceptionEventArgs e)
 {
     if (ReadExceptionEvent != null)
     {
         ReadExceptionEvent.Invoke(this, e);
     }
 }
Esempio n. 2
0
        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);
                }
            }
        }