Duplex communication with pipes - is possible ?

Dara Durum durumdara at gmail.com
Fri Jun 16 10:02:13 EDT 2006


Hi !

I want to create a Process Pool Object.
I can hold started processes, and can communicate with them.

I tryed with many ipc methods, but every of them have bug or other problem.
Sockets are unavailabe (because Windows Firewall hold them).

I think I will use pipe.

The object's pseudocode:
while not Quit:
 CheckProcessOutputs;
 ProcessReceivedData;
 SendDataToSubProcesses;
 if NoMoreData: Quit=1

If I used pipes and subprocess module in Windows, I got big freezes,
and deadlocks.

Main proc:
subprocpipe.write('aaaa\n')
subprocpipe.readlines()

Sub proc:
input=sys.stdin.readlines().strip()
print input+'!!!'

It is working. But when I move this client code to cycle, I got deadlock.
while not Quit:
 input=sys.stdin.readlines().strip()
 print input+'!!!'
 Quit=input=='q'

Why ? Why I cannot create cyclic communication with client ?
Subprocess must "staying alive" (don't die), and need to stay in
reuseable state ?

Simply: subprocess pool needed !!!

Thanks for help:
dd



More information about the Python-list mailing list