qt-interest@trolltech.com
[Top] [All Lists]

Re: [Qt-interest] QProcess's bug?

Subject: Re: [Qt-interest] QProcess's bug?
From: Thiago Macieira
Date: Thu, 25 Jun 2009 18:23:15 +0200
Em Quinta-feira 25 Junho 2009, Ãs 16:42:53, Andreas Pakulat escreveu:
> On 25.06.09 20:07:33, éå wrote:
> > OK. Let me shows a complete code and it's logs.
> > Please anybody help me to resolve this problem.
> > Complete codes as follows:
>
> I think the fork'ing causes problems for the already existing QApplication
> and/or QProcess. At least I can make your example work as expected when
> moving the QApplication construction until after the forking.

The problem is not the forking. It's the use of exit instead of _exit.

When forking, you MUST either call one of the exec functions, or _exit. You 
must not call exit, as that runs global destructors and all sorts of de-
initialisation. It's that de-initialisation that is screwing up the process 
manager.

However, I am not entirely sure for one other reason: QProcess uses a second 
thread to handle process termination from a Unix signal handler (the process 
manager thread). If you fork, only one thread is forked. You don't get the 
other threads, so if the parent process caused that thread to start, the child 
process will not be able to use QProcess either.
-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
_______________________________________________
Qt-interest mailing list
Qt-interest@xxxxxxxxxxxxx
http://lists.trolltech.com/mailman/listinfo/qt-interest
<Prev in Thread] Current Thread [Next in Thread>