title: Reading serial output from Pyserial doesnt work reliably
body: <p>I am connecting to device using code blow on MacOS and out of 100 times this code would make connection only 1 or two times and dones't respond(since there is no timeout) rest of the times.</p>
  
  <pre><code>ser = serial.Serial(port="/dev/xyz",timeout = None, baudrate=115200, parity = serial.PARITY_NONE, bytesize = serial.EIGHTBITS, stopbits = serial.STOPBITS_ONE)
  
  def exitSer(ser):
      print("Closing")
      ser.close()
  
  atexit.register(exitSer, ser)
  
  if ser.is_open:
      time.sleep(2)
      while(1):
          print(ser.readline().decode("utf-8"))
  </code></pre>
  
  <p>Could you please tell me how to use programs like fcntl etc to find if this port is completely free and available for use and how to set tty port's flags to free after making port free forcibly.</p>
  
  <p>Once this works, I have to run this multithreaded where each thread is running different devices expecting output in lines. Any suggestions for that just in case this works.</p>