System.IO.Ports.SerialPortBase.StopReading C# (CSharp) Méthode

StopReading() protected méthode

Stops waiting for data.
protected StopReading ( ) : void
Résultat void
        protected virtual void StopReading()
        {
            _continueReading = false; // If the ReadLoop is not in the _port.Read() method, the soft way will work.

            if (_readThread != null && _readThread.ThreadState == ThreadState.WaitSleepJoin) // otherwise,
                _readThread.Abort();                                                          // take a hammer (we need to end the thread, otherwise it would steal the next data coming)

            if (_readToEvent != null)                                                         // if ReadTo() method is being called,
                _readToEvent.Set();                                                           // let it know we have some new data to check
        }