Re: forking an external process



On Tue, 2002-05-07 at 16:04, Kim Schulz wrote:
hi

I want my gui to be accesable even when an external process is doing
some work.
My program does the following:
initialise the GUI
exec of a wget process
wait for it to return 
do somthing to the return which will update the GUI (add rows to a
clist)

as it is now it hangs while the wget process is running. I have tried to
fork it but it doesnt work:
<snip />

That depends on your definition of works.  When you fork a process it
splits into two independent process.  The split occurs at the fork and
the only difference between the two processes is that one gets a return
of 0 from fork and the other gets the PID of the other process.  So what
happend in your code was one process exec'ed wget and the other ran
parse_xml().  What you need to look into is inter-process communication
(perldoc perlipc).  Luckily Gtk provides a mechanism for monitoring
files (and consequently sockets since they are just specialized files): 
Gtk::Gdk->input_add.
-- 
Today is Boomtime the 54th day of Discord in the YOLD 3168


Missile Address: 33:48:3.521N  84:23:34.786W




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]