Aborting a read with pySerial

J

John Nagle

I'm using pySerial to read from a serial port.
One thread reads from the port, with no timeout.
Another thread handles output and other tasks. This works
fine until I want to shut down the program. I can't reliably
break the program out of the read when it's waiting. On Windows,
closing the serial port will abort the read, but that seems to have no
effect on Linux.

I know, I could put a timeout on the read and handle all those
null returns. Is there a better way?

John Nagle
 
A

Aahz

I'm using pySerial to read from a serial port. One thread reads from
the port, with no timeout. Another thread handles output and other
tasks. This works fine until I want to shut down the program. I can't
reliably break the program out of the read when it's waiting. On
Windows, closing the serial port will abort the read, but that seems to
have no effect on Linux.

I know, I could put a timeout on the read and handle all those null
returns. Is there a better way?

No
--
Aahz ([email protected]) <*> http://www.pythoncraft.com/

[on old computer technologies and programmers] "Fancy tail fins on a
brand new '59 Cadillac didn't mean throwing out a whole generation of
mechanics who started with model As." --Andrew Dalke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top