Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96755
| References | <mte0vh$alh$1@dont-email.me> |
|---|---|
| Date | 2015-09-17 19:42 +1000 |
| Subject | Re: pyserial and threads |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.691.1442482931.8327.python-list@python.org> (permalink) |
On Thu, Sep 17, 2015 at 7:28 PM, pozz <pozzugno@gmail.com> wrote: > At startup I open the ports and create and start a thread to manage the > receiving. When a byte is received, I call the .write() method for all the > other ports. > > It works, but sometimes it seems to block. I think I haven't used correctly > the threads. > Seems a fairly reasonable model. From what I'm seeing here, you start a thread to read from each serial port, but then those threads will make blocking writes to all the other serial ports. Is it possible that one of them is getting full? When I do this kind of thing with TCP/IP sockets, I usually end up having to go non-blocking in both directions, and maintaining a buffer of unsent text for each socket. You may find that you need to do the same thing here. Where's the code getting blocked? ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pyserial and threads pozz <pozzugno@gmail.com> - 2015-09-17 11:28 +0200
Re: pyserial and threads Chris Angelico <rosuav@gmail.com> - 2015-09-17 19:42 +1000
Re: pyserial and threads pozz <pozzugno@gmail.com> - 2015-09-17 15:26 +0200
Re: pyserial and threads Chris Angelico <rosuav@gmail.com> - 2015-09-17 23:45 +1000
Re: pyserial and threads alister <alister.nospam.ware@ntlworld.com> - 2015-09-17 12:00 +0000
Re: pyserial and threads Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-09-17 09:04 -0400
Re: pyserial and threads pozz <pozzugno@gmail.com> - 2015-09-17 15:23 +0200
Re: pyserial and threads pozz <pozzugno@gmail.com> - 2015-09-17 15:22 +0200
csiph-web