On 23Nov2015 12:22, Israel Brewster <isr...@ravnalaska.net> wrote:
On Nov 23, 2015, at 11:51 AM, Ian Kelly <ian.g.ke...@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 <c...@zip.com.au>
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to