Bi-directional sub-process communication

Ian Kelly ian.g.kelly at gmail.com
Tue Nov 24 16:53:17 EST 2015


On Mon, Nov 23, 2015 at 10:25 PM, Cameron Simpson <cs at zip.com.au> wrote:
> Then #3. I would have a common function/method for submitting a request to
> go to the subprocess, and have that method return an Event on which to wait.
> Then caller then just waits for the Event and collects the data. Obviously,
> the method does not just return the Event, but an Event and something to
> receive the return data. I've got a class called a Result for this kind of
> thing; make a small class containing an Event and which will have a .result
> attribute for the return information; the submitting method allocates one of
> these and returns it. The response handler gets the instance (by looking it
> up from the tag), sets the .result attribute and fires the Event. Your
> caller wakes up from waiting on the Event and consults the .result
> attribute.

Your Result sounds suspiciously like a Future. ;-)



More information about the Python-list mailing list