Re: Forking from Gtk



On Tue, Jul 08, 2008 at 10:17:53AM +0200, Gabriele Greco wrote:
On Mon, Jul 7, 2008 at 11:03 PM, G Hasse <gorhas raditex se> wrote:

Hello,

I have a small demo app. This works on FreeBSD but I can't
get to work on Linux. I know that in Linux setsid will fail
if the child has the same session_id as the parent. So on
Linux you must fork twice. But it also seems that the parent
must do an exit. And I don't want that. The code is not very
long - so I include it here.



I think you should avoid fork and use one of the functions glib provide to
spawn processes (
http://library.gnome.org/devel/glib/stable/glib-Spawning-Processes.html), or
a thread if you need to simply call a function.

In general using fork() in a GUI program is a bad idea.

But I realy NEED to create a longlived process (running for a week or
month) and be able to quit the GUI whenever I like. The glib is
just a wrapper - and i don't se the solution...

I realy WANT to lose contact with the child process. And there
is to mutch data from the GUI to pass it on the command line...

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse           email: gorhas raditex se  Tel: 019-450105
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------




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