Example #1
0
 public void RunTaskForHandler(TcpToSerialBridge handler, Action <Exception> handleError)
 {
     if (_handler == null || _task != null && !IsThreadActive(_task))
     {
         _handler = handler;
         _task    = new Thread(() => SafeThreadRun(() => _handler.Run(), handleError));
         _task.Start();
     }
 }
Example #2
0
 public void StopTask()
 {
     if (_handler == null)
     {
         return;
     }
     _handler.Stop();
     _task.Join();
     _handler = null;
     _task    = null;
 }