title: Use SerialPort commands in a Thread C#
body: <p>I have a thread, and I want to send some command with Serial Port. How Can I do this?</p>
  
  <pre><code>Thread execProcess = new Thread(eProcess);
  
  static bool isRunning = false;
  
  static void eProcess()
  {
      while(true)
      {
          if(isRunning)
          {
              sendCmd(cmd); //cmd is a string
          }
      }
  }
  
  void sendCmd(string cmd)
  {
     serialPort.WriteLine(cmd);
  }
  </code></pre>
  
  <p>How can I do this?</p>