Inter process communication using Tk/send hangs on suspended processes

Rob W. W. Hooft rob at hooft.net
Tue Feb 22 08:14:56 EST 2000


>>>>> "GM" == Greg McFarlane <gregm at iname.com> writes:

 GM> On 18 Feb, Rob W. W. Hooft wrote:
 >> >>>>> "GM" == Greg McFarlane <gregm at iname.com> writes:
 GM> On 15 Feb, Rob W. W. Hooft wrote:
 >> >> I have a group of python programs. Whenever any new program is
 >> started, it will try to establish connections to each of the other
 >> ones using Tk/send (it is asking each for their background color,
 >> and will choose a new one for itself).
 >> 
 GM> The only things I can think of are to fork separate processes to
 GM> do each send and kill them if they do not respond quickly.
 >>  That doesn't work, as this will result in X requests that arrive
 >> out-of-order. As far as I know, no 2 processes can share their X
 >> socket connection. I guess I'll have to investigate the "server"
 >> concept.

 GM> That is only true if you fork without exec'ing and are not
 GM> careful about closing the inherited file descriptors.  What I
 GM> meant was to fork *and exec* another process, passing in
 GM> information like the X display using the command line arguments.

Yikes, that sounds really expensive: execing another python process,
and importing Tkinter in there..... I guess I could do one fork/exec
for all queries. I'll have a look. 

The alternative idea of a server that is automatically (re-)started to
keep a centralized database sounds very nice as well. More work to get
started, but very powerful!

Thanks for all help,

Rob Hooft.

-- 
=====   rob at hooft.net          http://www.xs4all.nl/~hooft/rob/  =====
=====   R&D, Nonius BV, Delft  http://www.nonius.nl/             =====
===== PGPid 0xFA19277D ========================== Use Linux! =========




More information about the Python-list mailing list