[Newbie] How to wait for asyncronous input
pozz
pozzugno at gmail.com
Sat Aug 11 03:07:51 EDT 2012
Il 11/08/2012 01:12, Dennis Lee Bieber ha scritto:
> What you apparently missed is that serial.read() BLOCKs until data
> is available (unless the port was opened with a read timeout set).
> [...]
>
> serial.read() may, there for, be using select() behind the scenes.
Hmm..., so I could open the serial port with timeout=0 so the read(),
that runs in a different thread, would block forever, so putting the
thread in a sleep state until some bytes arrive.
When the main thread wants to close the serial port, the receiving
thread can be killed (I don't know why, but I think it will be possible).
More information about the Python-list
mailing list