Re: forking heap question



Paul Davis wrote:
> 
> >parent heaps totally independent, as should be. Maybe there is a way to
> >tell gtk at the fork point whether child or parent will keep the widgets
> >instead of leaving it up to gtk to decide?
> 
> there isn't any choice. the child cannot access the widgets. end of
> story. i didn't even both to check your code to notice that it was
> doing that. if you want to operate on widgets created in a given
> process, you need to be inside that process. once you fork, you can't
> access them anymore (well, not without expecting problems). what makes
> you think you could do this?

Because I do it in a program many people are actually using. (see below)

> 
> >subroutine is performed within a simple loop. I have also noticed that
> >with gtk either the parent or the child can take over the gtk widgets,
> >depending on who accesses them first. So I believe some error (probably
> 
> what code are you looking at that makes you think it works this way?
> 
> --p

In the program called xfdiff, which you can find source code at CVS from
sourceforge under the xfce desktop environment, after the fork I let the
child process take over the widgets and the parent will _exit() after
doing its thing. Why do I do this in this fashion? Because it is an easy
way to get rid of zombies without having to waste cpu time on wait()
calls. I probably should not do it, but since xfdiff involves two forks
and an triangle pipe configuration, it's so much easier.

-- 

saludos,

Edscott



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