Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #99284 > unrolled thread

Re: Bi-directional sub-process communication

Started byCameron Simpson <cs@zip.com.au>
First post2015-11-24 08:45 +1100
Last post2015-11-24 08:45 +1100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Bi-directional sub-process communication Cameron Simpson <cs@zip.com.au> - 2015-11-24 08:45 +1100

#99284 — Re: Bi-directional sub-process communication

FromCameron Simpson <cs@zip.com.au>
Date2015-11-24 08:45 +1100
SubjectRe: Bi-directional sub-process communication
Message-ID<mailman.77.1448316242.2291.python-list@python.org>
On 23Nov2015 12:22, Israel Brewster <israel@ravnalaska.net> wrote:
>On Nov 23, 2015, at 11:51 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
>> Concurrency, ugh.

I'm a big concurrency fan myself.

>> It's probably better just to have a Condition/Event per thread and
>> have the response thread identify the correct one to notify, rather
>> than just notify a single shared Condition and hope the threads wake
>> up in the right order.
>
>Tell me about it :-) I've actually never worked with conditions or 
>notifications (actually even this bi-drectional type of communication is new 
>to me), so I'll have to look into that and figure it out. Thanks for the 
>information!

I include a tag with every request, and have the responses include the tag; the 
request submission function records the response hander in a mapping by tag and 
the response handing thread looks up the mapping and passes the response to the 
right handler.

Works just fine and avoids all the worrying about ordering etc.

Israel, do you have control over the protocol between you and your subprocess?  
If so, adding tags is easy and effective.

Cheers,
Cameron Simpson <cs@zip.com.au>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web