On May 8, 2009, at 8:14 AM, Martin Peach wrote:
Hans-Christoph Steiner wrote:
So right now, when [comport] is open and that device gets
disconnected, comport freezes and Pd crashes. My guess is that
comport is waiting and therefore blocking. It seems like the
select() call should prevent that, any other guesses on how to
prevent comport from locking like this? Many arduino users would
be very happy.Is this on linux? It should be non-blocking on Windows. I suppose it crashes only when you try to send something, not if you
just pull the cable out. I would have thought that if hardware
handshaking was off, the port will send anyway. I seem to remember
sending into an oscilloscope probe with no cable present. Select is problematic, as we have seen with recent [tcpserver],
checking if each byte can be sent before it goes out slows the whole
thing down a lot.
This is on Mac OS X mostly, but maybe linux too. It seems odd that
select() would slow things down so much. Perhaps there is some kind
of flag that can lighten the load.
This stuff is definitely a pain.
.hc
Programs should be written for people to read, and only incidentally
for machines to execute.