[Qt-interest] QProcess's bug?
Thiago Macieira
thiago.macieira at trolltech.com
Thu Jun 25 18:23:15 CEST 2009
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090625/f4475988/attachment.bin
More information about the Qt-interest-old
mailing list