Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96755
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail |
|---|---|
| Return-Path | <rosuav@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'startup': 0.05; 'cc:addr :python-list': 0.09; 'block.': 0.09; 'non-blocking': 0.09; 'port,': 0.09; 'tcp/ip': 0.09; 'threads.': 0.09; 'thread': 0.10; 'thu,': 0.15; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'socket.': 0.16; 'subject:threads': 0.16; 'threads': 0.16; "where's": 0.16; 'wrote:': 0.16; 'byte': 0.18; '2015': 0.20; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'fairly': 0.22; 'sep': 0.22; 'seems': 0.23; "haven't": 0.24; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'blocking': 0.29; "i'm": 0.30; 'code': 0.30; 'writes': 0.30; 'getting': 0.33; 'usually': 0.33; 'open': 0.33; 'correctly': 0.34; 'maintaining': 0.34; 'received:google.com': 0.35; 'text': 0.35; 'sometimes': 0.35; 'but': 0.36; 'possible': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'end': 0.39; 'here.': 0.62; 'serial': 0.70; 'chrisa': 0.84; 'directions,': 0.84; 'ports.': 0.84; 'received,': 0.84; 'to:none': 0.91; 'ports': 0.93 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=AB6n2w6T22EXCEwqunFPynSqO88ezHacyXYQTbM3yhM=; b=0KB6UgpWarPhEpW2O9FNz+sZJmG0bf5kEARdtZZ0eLNkJwnW8Zo9Veh1nx8kKv7LjS kcni20HB/jgj8j1YulRlO+zGUOw65LQW+VQVOvud+ojJAFLqSHSXlCutIftnpG0FTaIO AoFiXumkvPJrP7LjjyCHqXm4n9DzlYdMxK2aupl6LqcRoPKo//fsx17OuSn71TVSqLlw l3/ZY8yUYS0BuDIObNgvgR3vdNiliQcLO/r/FkicAUHBNj4hh9f6kdSBvwVukXsAdOgB Z5PeoFws6SReXEzjFGogo5HvGpTW4S/J+ojfu76S8h6CkSsssyxu396UE/y26JOqZQs3 50yA== |
| MIME-Version | 1.0 |
| X-Received | by 10.107.36.72 with SMTP id k69mr4117116iok.157.1442482928177; Thu, 17 Sep 2015 02:42:08 -0700 (PDT) |
| In-Reply-To | <mte0vh$alh$1@dont-email.me> |
| References | <mte0vh$alh$1@dont-email.me> |
| Date | Thu, 17 Sep 2015 19:42:08 +1000 |
| Subject | Re: pyserial and threads |
| From | Chris Angelico <rosuav@gmail.com> |
| Cc | "python-list@python.org" <python-list@python.org> |
| Content-Type | text/plain; charset=UTF-8 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.20+ |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.691.1442482931.8327.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1442482931 news.xs4all.nl 23862 [2001:888:2000:d::a6]:37126 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:96755 |
Show key headers only | View raw
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